Date: Sun, 9 Feb 2003 16:10:02 -0500 Message-Id: <200302092110.h19LA2A19372@envy.delorie.com> X-Authentication-Warning: envy.delorie.com: dj set sender to dj AT delorie DOT com using -f From: DJ Delorie To: djgpp AT delorie DOT com In-reply-to: <20030209175718.GA31356@sprite.fr.eu.org> (message from Jeremie Koenig on Sun, 9 Feb 2003 18:57:19 +0100) Subject: Re: allocating big chunks with djgpp References: <200302091726 DOT h19HQxp16523 AT envy DOT delorie DOT com> <20030209175718 DOT GA31356 AT sprite DOT fr DOT eu DOT org> Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > > char **buffer2 = malloc(30000 * 81); > Bad. buffer2[x] will be an uninitialized pointer. Even if you want that > (you obviously don't for such purposes) you should include > sizeof(buffer2) as a factor of malloc() parameter. > > The right way, IMHO : > > char (*buffer)[81] = malloc(sizeof(buffer) * 30000); > > Which i think will actually work the same as the two above. Ack, you're right. I meant: char *buffer2 = malloc(30000 * 81); Then do the math when you reference it.