the scope of a pointer ???
- by numerical25
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.