From: Horst Kraemer Newsgroups: comp.os.msdos.djgpp Subject: Re: How to convert mode to "pointer to array"? Date: Wed, 26 Jul 2000 22:37:13 +0200 Lines: 25 Message-ID: References: <39780BA1 DOT 7354F5D2 AT umist DOT ac DOT uk> NNTP-Posting-Host: a1017.pppool.de (213.6.16.23) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: fu-berlin.de 964643825 5225111 213.6.16.23 (16 [27606]) X-Newsreader: Forte Agent 1.8/32.548 trialware To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On Fri, 21 Jul 2000 09:36:49 +0100, Anthony Appleyard wrote: > I wrote a Gnu C++ program with this text in;- > > class atom{public: double x,y,z; char mat,vis; atom(){}; > atom(xyz c,char m=0,char v=0){x=c.x; y=c.y; z=c.z; mat=m; vis=v;}; > > atom((*C)[N+1][N+1])= /*HERE*/ malloc((N+1)*(N+1)*(N+1)*sizeof(atom)); > > My Gnu C++ compiler accepts this, but moans that implicit conversion > from void* to a pointer is non-ANSI, so I likely couldn't use that > program text in my good old faithful Borland C++ 4.52 for Windows. To > make this text ANSI, what should I insert at /*HERE*/ ? Nothing. You should use 'new' instead of malloc. atom (*C)[N+1][N+1] = new atom [N+1][N+1][N+1]; supposing that N is a macro or a const known at compile time. Regards Horst