recur.c 317 B

123456789101112131415161718
  1. /* recur.c -- recursion illustration */
  2. #include <stdio.h>
  3. void up_and_down(int);
  4. int main(void)
  5. {
  6. up_and_down(1);
  7. return 0;
  8. }
  9. void up_and_down(int n)
  10. {
  11. printf("Level %d: n location %p\n", n, &n); // 1
  12. if (n < 4)
  13. up_and_down(n+1);
  14. printf("LEVEL %d: n location %p\n", n, &n); // 2
  15. }