Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!watvlsi!padpowell From: padpowell@watvlsi.UUCP Newsgroups: comp.lang.fortran,comp.lang.pascal Subject: Re: Array storage order Message-ID: <3538@watvlsi.UUCP> Date: Tue, 30-Jun-87 13:56:51 EDT Article-I.D.: watvlsi.3538 Posted: Tue Jun 30 13:56:51 1987 Date-Received: Fri, 3-Jul-87 05:49:01 EDT References: <1215@batcomputer.tn.cornell.edu> <105@anumb.UUCP> Reply-To: padpowell@watvlsi.UUCP (Patrick Powell) Organization: U. of Waterloo, Ontario Lines: 21 Xref: utgpu comp.lang.fortran:115 comp.lang.pascal:153 In article <105@anumb.UUCP> eao@anumb.UUCP (e.a.olson) writes: >> >> One of the questions that has come up is with respect to the storage >> order of 2-dimensional arrays. In C, array element [1][2] is stored >> in memory immediately after element [1][1]. I believe this is locked >> into the language - pointer arithmetic and all that. On the Fortran >> compilers I can get to, (2,1), not (1,2), immediately follows (1,1). >> The pascal I haven't investigated yet. >> Question: is this array storage order mandated by the Fortran-77 standard? >> How about the Pascal standard? If so, then I'll document the arrays as being >> garry wiegand (garry@oak.cadif.cornell.edu - ARPA) >> (garry@crnlthry - BITNET) > The order is mandated by the standard. > In fortran, arrays are stored in row-major order. In 'C' > and Pascal arrays are stored in column-major order. NO NO NO... Other way around. Fortran Columns, Pascal and C are rows. Don't worry, I've had days like that. In fact, I've had LIVES like that. Patrick ("Read the manual? What manual? OHHH! THAT manual...") Powell