#include <stdio.h>

int* func2()
{
   int x = 50;
   printf("in func2\n");
   return &x;  // this is bad because we are returning the adddress of a local (stack) variable
}

void func1()
{
   int *y;
   printf("in func1\n");
   y = func2();
   printf("*y = %d\n", *y);
}

int main()
{
   func1();
   return 0;
}