edited by
473 views
1 votes
1 votes
What is the output of the program:

extern int a;

main()

{

     extern int a;

     printf(a);

}
edited by

3 Answers

Best answer
1 votes
1 votes

It will throw a compile time error which would look something like : 

undefined reference to `a'

because extern variable declarations look for a variable defined with the same name defined globally.

selected by
1 votes
1 votes

It will generate compilation error 

undefined symbol a 

But if declaration is done at global a like

extern int a= 5;

Then there will be no error and it will print 5.

0 votes
0 votes
it will print global variable a with same defined in main function . no need of externl in global declartion

No related questions found