Puzzle SL23


Rule 2.1 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();

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

Notice that the keyword extern is used in two of declarations of x How many entities x are there?



Answer         Next Page         Previous Page Home