Exactly, any local variable comes off the stack, but I was talking about pointers :)
On Wed, Mar 30, 2016 at 3:37 PM, Steve Litt <sl...@troubleshooters.com> wrote: > On Wed, 30 Mar 2016 08:23:16 -0300 > Emiliano Marini <emilianomarin...@gmail.com> wrote: > > > Edward, the only time the compiler allocates memory for data > > automatically is when using strings literals (as stated by Rainer > > previously) > > > > char *p = "Hola mundo." > > Also when you have a struct as a local variable: > > struct my_cool_struct mystruct; > > Like the char pointer, it comes off the stack, not the heap it would > come off if you used malloc(). > > Actually, any local variable allocates memory off the stack. Consider: > > int number_of_people; > > The preceding allocates sizeof(int) bytes, for number_of_people, off > the stack. > > SteveT > > Steve Litt > March 2016 featured book: Quit Joblessness: Start Your Own Business > http://www.troubleshooters.com/startbiz > _______________________________________________ > Dng mailing list > Dng@lists.dyne.org > https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng >
_______________________________________________ Dng mailing list Dng@lists.dyne.org https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng