What is the output of following C program And how is the output printed when all variables of fun() after closing got their memory de-allocated.
#include<stdio.h>
int * fun()
{
int q = 10;
int *p;
p = &q;
return p;
}
int main()
{
int *res;
res= fun();
printf("%d", *res);
return 0;
}
I expected the pointer res to point to null