| delorie.com/archives/browse.cgi | search |
| From: | "Andrew Hurrell" <andrew AT amh-consulting DOT freeserve DOT co DOT uk> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: how do I use 2D variables |
| Date: | Wed, 2 Feb 2000 00:25:20 -0000 |
| Organization: | Customer of Planet Online |
| Lines: | 58 |
| Message-ID: | <87ahtd$9tj$1@newsg4.svr.pol.co.uk> |
| References: | <8722e8$res$1 AT zingo DOT tninet DOT se> <3894BC87 DOT 8ED55889 AT geocities DOT com> <872lf8$top$1 AT newsg3 DOT svr DOT pol DOT co DOT uk> <876scd$jq1$1 AT news DOT netpower DOT no> |
| NNTP-Posting-Host: | modem-186.hippo-tang.dialup.pol.co.uk |
| X-Trace: | newsg4.svr.pol.co.uk 949537517 10163 62.137.28.186 (3 Feb 2000 00:25:17 GMT) |
| NNTP-Posting-Date: | 3 Feb 2000 00:25:17 GMT |
| X-Complaints-To: | abuse AT theplanet DOT net |
| X-Newsreader: | Microsoft Outlook Express 5.00.2014.211 |
| X-MimeOLE: | Produced By Microsoft MimeOLE V5.00.2014.211 |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
>
> Would the new operator work with 2+ dimentional arrays, instead of malloc?
> example...
Not quite sure that I understand your question, but if you mean can you
dynamically assign an array with more than two dimensions the answer is
yes - you can have as many dimensions as you like !
If you want more info email me privately since this is a little OT.
All the best
Andrew
> > Or you could use a multidimensional array
> > e.g.
> > int a[10][10][10] and reference a[i][j][k]
> >
> > or use int **a and use malloc to dynamically allocate storage
> >
> > If you need some storage allocator code - drop me an email
> >
> > > if i understand correctly:
> > >
> > > // for 2d
> > > struct twoD {
> > > int x;
> > > int y;
> > > };
> > >
> > > struct threeD {
> > > int x;
> > > int y;
> > > int z;
> > > };
> > >
> > > void main() {
> > > twoD a;
> > > threeD b;
> > >
> > > a.x = 10;
> > > b.z = 15;
> > > }
> > >
> > > "Börje Granberg" wrote:
> > > >
> > > > How do I define and use 2D,3D etc. 'var(x,y)' I don't have a clue
> >
> >
> >
>
>
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |