delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/25/15:15:48

From: "Brett Kugler" <w003132 AT mail DOT airmail DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Dynamic Arrays and C++
Date: 25 Jun 1998 18:41:06 GMT
Organization: Airnews! at Internet America
Lines: 23
Message-ID: <AEA709B50D3807D4.DBB9E9D19B2BCC95.9840599F888D1195@library-proxy.airnews.net>
Abuse-Reports-To: abuse at airmail.net to report improper postings
NNTP-Proxy-Relay: library.airnews.net
NNTP-Posting-Time: Thu Jun 25 13:41:06 1998
NNTP-Posting-Host: PQbr<+EoLn1GL[@+<X3h/0JkIA1_n;D.R`2 (Encoded at Airnews!)
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];

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.

Any ideas?

Thanks,
Brett

- Raw text -


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