edited by
201 views
0 votes
0 votes
int main()//assuming that the variable 'i' is not defined in any other file,
{
    extern int i;
    i=10;
    printf("%d",i);
    return 0;
}


A.10  B.0

C.COMPILER ERROR  D.linker error

edited by

1 Answer

1 votes
1 votes
It will give linker error.

'extern' will try to access x value outside of main(). But x declared inside main(). So, unable to access it. So, give linker error.

Related questions

1 votes
1 votes
0 answers
1
Balaji Jegan asked Oct 23, 2018
211 views
0 votes
0 votes
0 answers
2
Gatetarget_100 asked Aug 3, 2018
553 views
int main() { int a[10]; printf("%d",*a+1-*a+3); return 0; }Answer is given as 4 but i think it should be 8, if int is of 4 byte. Correct me if i am wrong
1 votes
1 votes
0 answers
3
Shijith M asked Aug 1, 2018
802 views
int main(){ static int i=5; if( i){ main(); printf("%d ",i); }} This program answer is 0 0 0 0 .how is this? Please explain to me.
0 votes
0 votes
0 answers
4
Harikesh Kumar asked Dec 4, 2017
192 views