Puzzle SL20


What does the following code write to the monitor?

#include <stdio.h>

int x = 0 ;

int funA( int x )
{
  return x+1;
}

int funB( int x )
{
  return funA( x+1 );
}

int funC( int x )
{
  return funB( x+1 );
}

int main ( void )
{
  printf("funC is %d\n", funC( x ) );

  return 0 ;
}

This puzzle is not particularly tricky. Just a lot of different x's to keep track of, and a rule about initialization.



Previous Page        Answer         Next Page         Home