"row major" - technically no such thing in C?

Discussion in 'C Programming' started by Lax, Apr 12, 2008.

  1. Lax

    Lax Guest

    Isn't it "technically" meaningless to call C a "row major language,"
    since there are no such things as multidimensional arrays in C.

    In C you can define arrays of arrays, and the way that the
    declarations work (first index closest to identifier defines the
    largest arrays) makes it seems like C has row-major multidimensional

    No need to mention "row major" when discussing C if one talks about
    "arrays of arrays" and the way C's declarations work "inside to
    out." Correct, no?

    And thanks to Ian Collins and Walter Robinson for your help with my
    previous post (on 'static' externals).
    Lax, Apr 12, 2008
    1. Advertising

  2. In article <>,
    Richard Heathfield <> wrote:
    >Lax said:
    >> Isn't it "technically" meaningless to call C a "row major language,"
    >> since there are no such things as multidimensional arrays in C.

    > of C89: "Successive subscript operators designate a member of a
    >multi-dimensional array object."
    > of C99: "Successive subscript operators designate an element of
    >a multidimensional array object."

    Nevertheless, it has been stated many times in this newgroup (by regs,
    including you; no, I'm not going to google it) that C does not have
    multidimensional arrays. It has been stated many times (yes, by you
    among others) that it has arrays of arrays.

    Of course, you claim that it doesn't have global variables, either...
    Kenny McCormack, Apr 13, 2008
    1. Advertising

  3. In article <>,
    Lax <> wrote:

    >Isn't it "technically" meaningless to call C a "row major language,"

    "Row major" is a bad term anyway, since there's no horizontal or
    vertical involved except in the user's interpretation. I prefer to
    talk of array subscripts varying in lexicographic order or not. That
    is, as your proceed through the memory of the array, do the subscripts
    change like the letters in an alphabetical list with the last one
    changing fastest, or the reverse?

    Given C's syntax for array indexing, it's inevitable that they
    should vary lexicographically. Given int a[5][5], a[3] is an
    array of 5 ints and a[3][0] ... a[3][4] must be consecutive
    in memory.

    >since there are no such things as multidimensional arrays in C.

    I think it would be possible to describe C's arrays without explicitly
    talking about multidimensional arrays at all, but the standard does
    refer to them. In fact, checking the C Rationale, I see it admits
    that the section on multidimensional arrays merely clarifies what
    follows anyway from the definition of 1-d arrays.

    -- Richard
    Richard Tobin, Apr 13, 2008
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jef Driesen
    Jef Driesen
    Jan 12, 2006
  2. sam
    James Kanze
    Sep 12, 2008
  3. ara howard
    ara howard
    Oct 28, 2003
  4. xliiv
    Adam Tauno Williams
    Mar 24, 2012
  5. OwlHoot
    Aug 23, 2007

Share This Page