From: Erik Max Francis Newsgroups: comp.os.msdos.djgpp Subject: Re: positive ints and arrays Date: Tue, 18 Aug 1998 08:59:56 -0700 Organization: Alcyone Systems Lines: 21 Message-ID: <35D9A4FC.1709C5CA@alcyone.com> References: <199808161131 DOT NAA08483 AT d1o22 DOT telia DOT com> <35D86D67 DOT FC0683E0 AT unb DOT ca> NNTP-Posting-Host: charmaine.alcyone.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Endlisnis wrote: > If you need more than one dimension to be > dynamic, then you have to 'fake-it'. If you want something NxM, then: > char* Array = new /* or malloc */ [N*M]; > Array[X*N+Y]; //To access Array[X][Y]. Not true. You can first allocate a array of pointers to the data type, and then for each element of the array allocate arrays of the data type and assign it to that index. That gives you a fully-dynamic two dimensional array, but in addition requires N + 1 pointers and N + 1 allocations. -- Erik Max Francis / email max AT alcyone DOT com / whois mf303 / icq 16063900 Alcyone Systems / irc maxxon (efnet) / finger max AT sade DOT alcyone DOT com San Jose, CA / languages En, Eo / web http://www.alcyone.com/max/ USA / icbm 37 20 07 N 121 53 38 W / &tSftDotIotE \ / Shooters, looters; now I got a laptop computer / Ice Cube