Answer: C
Before compilation the pre-processor takes the charge and handles pre-processor directives like:
- #define,
- #undef,
- #include,
- #ifdef,
- #endif,
- #if,
- #else….
so simply replace the contents of write.c file with the line – #include “write.c”
extern int count;
void write_extern()
{
count +=2;
}
#include<stdio.h>
int count = 5;
int main()
{
write_extern();
write_extern();
printf("%d", count);
}
the variable count used in printf() is declared at the top of the program so no compilation error.
extern will look for definition of the variable count in current and global scope which it finds.