Puzzle SL25


Rule 2.1

Will the following code compile? If so, what does it 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 = 77;
void main()
{
  foo();
  printf("%d\n", x );
}

This program is a slight variation of the previous one. Pay attention to the identifier x.



Answer         Next Page         Previous Page Home