delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/02/06/19:10:07

From: "doug" <deleveld AT dds DOT nl>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: array_ptr=malloc( 1024 * sizeof(int) ) vs int array[1024] - beginner
Date: 6 Feb 2000 23:32:17 GMT
Organization: none
Lines: 28
Message-ID: <01bf71c4$838196e0$e2247d81@default>
References: <87krv2$sp3$1 AT portraits DOT wsisiz DOT edu DOT pl>
NNTP-Posting-Host: client36-226.oprit.rug.nl
X-Trace: info.service.rug.nl 949879937 22281 129.125.36.226 (6 Feb 2000 23:32:17 GMT)
X-Complaints-To: newsmaster AT rug DOT nl
NNTP-Posting-Date: 6 Feb 2000 23:32:17 GMT
X-Newsreader: Microsoft Internet News 4.70.1155
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com


Chaos <chengin AT alpha DOT net DOT pl> schreef in artikel
<87krv2$sp3$1 AT portraits DOT wsisiz DOT edu DOT pl>...
> Hi there
> 
> Just like in the subject: what is the main difference between allocating
> memory by malloc (new) or by creating an array?
> I'd like to know where is that mem exactly taken from?


// IIRC C won't increase the size of your program from this
// (it uses some startup trickery) but C++ will !!!
char ThisIsGloballyAllocated[1000]

int main(void)
{
 char ThisIsOnTheStack[1000];
 static char ThisIsAlsoGloballyAllocated[1000]

 

}

Hope I got this right, but just in case I'm wrong
read a good book on C/C++ anyway...

Doug Eleveld

- Raw text -


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