my code:
Code:
#include <stdio.h>
int *pPointer;
void
my_function()
{
int nNumber;
nNumber = 25;
pPointer = &nNumber;
}
int main()
{
my_function();
printf("Value of *pPointer: %d\n", *pPointer);
}
terminal:
Code:
grytskiv@ZXDSL831II:~/scope$ gcc -ansi function.c -o function && ./function
Value of *pPointer: 25
grytskiv@ZXDSL831II:~/scope$
I recive value of "nNumber" variable. But "nNumber" is must deleted after complete execution function "my_function".
Why I recive value of removed variable?
May be this variable deleted but pice memory don't nulled, and this pice can modification other proccess or thread?