From: Weiqi Gao Newsgroups: comp.os.msdos.djgpp Subject: Re: Dynamic Arrays and C++ Date: Sat, 27 Jun 1998 05:30:42 +0000 Organization: CRL Network Services Message-ID: <35948382.E2647863@a.crl.com> References: NNTP-Posting-Host: a116023.stl1.as.crl.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 29 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Brett Kugler wrote: > > 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]; > > The error I get is: > main.cpp:15: initialization to `int *' from `int (*)[8]' > > According to my C++ book (How To Program C++ by Deitel), that is a > perfectly valid statement. I only have a vague notion of what the compiler > is trying to tell me. I have tried: > > int *test = new int[8]; > > and this works, so it's something to do with the extra dimension in the > array. The reason I'm posting here is because I'm trying to compile with > DJGPP and the book I have indicates that this should work, but it doesn't. You can always cast: int *test = (int*) new int[8][8]; but I doubt that will accomplish what you want to do. What is it that your code is trying to acomplish? -- Weiqi Gao weiqigao AT a DOT crl DOT com