Puzzle SL24


Rule 2.1, 2.2, and 2.4

What does the following code write to the monitor?


/* --- fileA.c --- */
int x = 8;

/* --- fileB.c --- */
void foo()
{
  extern int x;
  x = 99;
}

/* --- fileC.c --- */
#include <stdio.h>
void foo();

int x;
void main()
{
  foo();
  printf("%d\n", x );
}

Note that extern has been removed from one of the declarations.



Answer         Next Page         Previous Page Home