int * foo()
{
int b=8;
int * temp=&b;
return temp;
}
I have few questions,
- In which part of memory layout does *p present.
- I am copying the local variable address to the temp pointer without allocating the memory. But even then it stores the address of the local variable, how it is possible?.
- The program works fine for me, when i dereference it (the local variable definitely will not be there) how come i get the value still.
Really not understand anything. Can anyone please explain all my above queries in detail.