delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/07/09/15:47:29

From: Endlisnis <s257m AT unb DOT ca>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Dynamic Arrays and C++
Date: Wed, 8 Jul 1998 17:22:25 -0300
Organization: University of New Brunswick
Lines: 13
Message-ID: <Pine.SOL.3.96.980708171954.3501C-100000@sol.sun.csd.unb.ca>
References: <AEA709B50D3807D4 DOT DBB9E9D19B2BCC95 DOT 9840599F888D1195 AT library-proxy DOT airnews DOT net> <6o0ck8$hs0$1 AT news DOT bctel DOT net>
NNTP-Posting-Host: sol-alt1.unb.ca
Mime-Version: 1.0
In-Reply-To: <6o0ck8$hs0$1@news.bctel.net>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

->>Ok, I don't usually post here, but I've run out of options.  I've been
->>trying to figure out why I'm getting an error on this line of code:
->>
->>   int *test = new int[8][8];
	You can't dynamically allocate a multi-dimensional arrays in C++.
You could say:
int* test = new int[64];
And then use test[x*8+y] to resolve test[x][y].
Or, if the dimensions are constants, don't dynamically allocate.

	Endlisnis
[I have a pyramid of wingyness]

- Raw text -


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