ExamVeda
Login
Home
This question belongs to C Program C Miscellaneous
C Miscellaneous
?

Determine output:
void main()
{
      extern int i;
      i=20;
      printf("%d", sizeof(i));
}

Answer & Solution
Correct Answer: Option D

Linker error: undefined symbol '_i'. Explanation:
extern declaration specifies that the variable i is defined somewhere else. The compiler passes the external variable to be resolved by the linker. So compiler doesn't find any error. During linking the linker searches for the definition of i. Since it is not found the linker flags an error.

Examveda
Question posted by Examveda
Community

Join the Discussion

1 Comment
Mankala Sowmyalakshmi
Mankala Sowmyalakshmi 8 years ago
can you please explain me in the above question, why it is not seeking any compilation error??