Hello, I need to know why the following piece of code works... It is strange for me...
x is a local variable that must be deleted from memory when fct exits...Code:#include <stdio.h>
int * fct (void)
{ int x = 2; return &x; }
void main(void)
{
printf("%d\n", *fct());
}
I cannot explain why the program works using visual studio 2010.
Please elucidate me :)
Thank you,
Alex