/* File: stack1.c

   Demonstrate that local variables are placed on a "stack"
*/

#include <stdio.h>

double func1 (void) ;
double func2 (void) ;
double func3 (void) ;


double func1 (void)  {
   double x  ;

   printf("func1: Address of x = %u\n", &x) ;
   x = func2() ;
   return x ;
}

double func2 (void)  {
   double x ;

   printf("func2: Address of x = %u\n", &x) ;
   x = func3() ;
   return x ;
}

double func3 (void)  {
   double x ;

   printf("func3: Address of x = %u\n", &x) ;
   x = 17 ;
   return x ;
}

main() {
   double x ;

   printf("Size of double = %d\n\n", sizeof(double) ) ;
   printf("main:  Address of x = %u\n", &x) ;
   x = func1() ;
}
