Date: Sun, 9 Feb 2003 18:57:19 +0100 To: djgpp AT delorie DOT com Subject: Re: allocating big chunks with djgpp Message-ID: <20030209175718.GA31356@sprite.fr.eu.org> Mail-Followup-To: djgpp AT delorie DOT com References: <200302091726 DOT h19HQxp16523 AT envy DOT delorie DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200302091726.h19HQxp16523@envy.delorie.com> User-Agent: Mutt/1.5.3i From: Jeremie Koenig 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 On Sun, Feb 09, 2003 at 12:26:59PM -0500, DJ Delorie wrote: > char buffer[30000][81]; Ok > int foo() > { > static char buffer[30000][81]; Ok, too. > 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. -- Jeremie Koenig