back

Quick Test 16: Recursive Programming

Consider the following program:

#include <stdio.h>
float a;

float XfuncN(float x, int n)
{
  float c;

  c = 0.0;
  if (n==0)
    return(1.0)
  else
    return(x*XfuncN(x, n-1));
}

void main()
{
  printf("%0.1f", XfuncN(3.0, 3));
}

1. What is the output of the program?

2. How many copies of the local variable c exists at maximum?