the scope of a pointer ???
Posted
by numerical25
on Stack Overflow
See other posts from Stack Overflow
or by numerical25
Published on 2010-06-02T00:05:27Z
Indexed on
2010/06/02
0:13 UTC
Read the original article
Hit count: 714
Ok, so I did find some questions that were almost similar but they actually confused me even more about pointers.
http://stackoverflow.com/questions/2715198/c-pointer-objects-vs-non-pointer-objects-closed
In the link above, they say that if you declare a pointer it is actually saved on the heap and not on the stack, regardless of where it was declared at. Is this true ?? Or am I misunderstanding ??? I thought that regardless of a pointer or non pointer, if its a global variable, it lives as long as the application. If its a local variable or declared within a loop or function, its life is only as long as the code within it.
© Stack Overflow or respective owner