From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,69297f5d572c2692 X-Google-Attributes: gid103376,public From: "Matthew Heaney" Subject: Re: Newbie Arrays Date: 1999/08/14 Message-ID: <37b5a36d@news1.us.ibm.net>#1/1 X-Deja-AN: 512778743 Content-transfer-encoding: 7bit References: <7p1555$bf0$1@dailyplanet.wam.umd.edu> X-Trace: 14 Aug 1999 17:12:13 GMT, 129.37.62.181 Organization: Global Network Services - Remote Access Mail & News Services X-Notice: should be reported to postmaster@ibm.net Content-Type: text/plain; charset="US-ASCII" Mime-version: 1.0 Newsgroups: comp.lang.ada X-Complaints-To: postmaster@ibm.net Date: 1999-08-14T00:00:00+00:00 List-Id: In article <7p1555$bf0$1@dailyplanet.wam.umd.edu> , rayoub@wam.umd.edu (Ronald Ayoub) wrote: > Right now I'm learning about multidimensional arrays and arrays of arrays. > I want to do something similiar to this with multidimensional arrays: > > for I in V'first..V'last loop > for J in V(I)'first..V(I)'last loop > V(I)(J) := I * J; > end loop; > end loop; for I in V'Range (1) loop for J in V'Range (2) loop V (I) (J) := I * J; end loop; end loop; > but I can't see how to use the 'first and 'last attributes with > multidimensional arrays. Like the 'Range attribute, the 'First and 'Last attributes take a parameter specifying which dimension. But never say for I in V'First (1) .. V'Last (1) loop ...; Instead, say for I in V'Range (1) loop ...; > In C there is no real difference between > an array of arrays and a multidimensional arrays except syntactically. Not quite. In C, there is no such thing as a multidimensional array. All arrays are really arrays-of-arrays. Read Expert C Programming, by Peter van der Linden, for a good discussion of this. > Are array of arrays more commonly used by Ada programers. In Ada, we have both arrays-of-arrays, and true multidimensional arrays. Which is used depends on the nature of the problem.