:: Re: [DNG] Making sense of C pointer…
Top Page
Delete this message
Reply to this message
Author: Emiliano Marini
Date:  
To: Steve Litt
CC: dng
Subject: Re: [DNG] Making sense of C pointer syntax.
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 <slitt@???>
wrote:

> On Wed, 30 Mar 2016 08:23:16 -0300
> Emiliano Marini <emilianomarini82@???> 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@???
> https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
>