1
0

loccheck.c 709 B

12345678910111213141516171819202122232425
  1. /* loccheck.c -- checks to see where variables are stored */
  2. #include <stdio.h>
  3. void mikado(int); /* declare function */
  4. int main(void)
  5. {
  6. int pooh = 2, bah = 5; /* local to main() */
  7. printf("In main(), pooh = %d and &pooh = %p\n",
  8. pooh, &pooh);
  9. printf("In main(), bah = %d and &bah = %p\n",
  10. bah, &bah);
  11. mikado(pooh);
  12. return 0;
  13. }
  14. void mikado(int bah) /* define function */
  15. {
  16. int pooh = 10; /* local to mikado() */
  17. printf("In mikado(), pooh = %d and &pooh = %p\n",
  18. pooh, &pooh);
  19. printf("In mikado(), bah = %d and &bah = %p\n",
  20. bah, &bah);
  21. }