#include <stdio.h>
void foo(int **p)
{
int j=2;
*p=&j;
printf("%d \n",**p );
}
int main()
{
int i=97 ;
int *p=&i;
foo(&p);
printf("%d \n",*p );
return 0;
}
According to definition :A local variable is destroyed at the moment that the program execution reaches the end of the method in which the local variable is defined Then how in main() func it is still able to print 2. If int j=2; is already destroyed? Is it like the variables gets destroyed but it is still accessible by addresses?I know this is call by reference