delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/02/17/17:45:02

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
From: "Tim Nicholson" <djgpp AT gizzy DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: arrays in an array
Date: Sun, 17 Feb 2002 22:35:05 +0000 (UTC)
Organization: BT Openworld
Lines: 62
Message-ID: <a4pb6p$330$1@helle.btinternet.com>
References: <PyUb8.5637$I01 DOT 244480 AT news20 DOT bellglobal DOT com>
NNTP-Posting-Host: host217-35-65-128.in-addr.btopenworld.com
X-Trace: helle.btinternet.com 1013985305 3168 217.35.65.128 (17 Feb 2002 22:35:05 GMT)
X-Complaints-To: news-complaints AT lists DOT btinternet DOT com
NNTP-Posting-Date: Sun, 17 Feb 2002 22:35:05 +0000 (UTC)
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MSMail-Priority: Normal
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

To access the third element of the second element of the array a1 - You
enter a1[1][2] - This is almost what you had but without the dot and the
fact that *each* array starts at zero so the third element is 2 not 3.

If you wanted an array of 10 elements each containing an array of 12
integers the definition would be

int a1[10][12];      and the last element in the array would be a1[9][11]

With out knowing what you really want to achieve, I cannot offer much more
assistance. Why do you say you do not want to use multidimensional arrays?
What you drew is a multidimensional array! - If you could explain your
reasoning, I might be able to offer alternative solutions.

Tim


"PM" <sendto DOT paulm AT sympatico DOT ca> wrote in message
news:PyUb8.5637$I01 DOT 244480 AT news20 DOT bellglobal DOT com...
> hey there im having a little bit of a coding problem.. ive got the
algorithm
> down but cant figure out the coding part.
>
> heres what i wanna do.. i would like to access an array element whos array
> is an element itself.. for example
>
> lets say we have an array a1, whos elements are arrays
>
> _______________________
> |___|____|___|___|____|___|
> and inside these elements there are more arrays
> |___||___||___||___||___||___|
> |___||___||___||___||___||___|
> |___||___||___||___||___||___|
> |___||___||___||___||___||___|
>
> my question is this..
> how would i be able to access.. say the 3rd element in the 2nd element of
> the array?
> eg.
> _______________________
> |___|__o_|___|___|____|___|
>            V
> |___||___||___||___||___||___|
> |___||___||___||___||___||___|
> |___||_o_||___||___||___||___|
> |___||___||___||___||___||___|
>
> would i do something like this??
> a1[1].[3] or soemthing like that??
>
> plus, i dont want to set it up as a multidimensional array. because im
> trying to simulate grocery store checkout stations.
>
> Please, I would appretiate any help!!
>
> Thanks,
> Paul M.
>
>


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019