Welcome Guest | Sign in | Register
Inbuilt Functions - Discussion Page For Q.10684 | C Programming Questions and Answers | C Programming Free Online-Tests | LucentBlackBoard | LucentBlackBoard.com

Home > Java Programming > Inbuilt Functions > Questions and Answers

Q: What will be the output of following C code?
main()
{
extern int i;
i=20;
printf("%d",sizeof(i));
}
A. Linker error B. Compiler error
C. 20 D. 0

Answer and Explanation

Answer:Linker error

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 an error. During linking the linker searches for the definition of i. Since it is not found the linker shows an error.

Comment on this Question

Name:

Loading...




Partner Sites
LucentBlackBoard.com                  SoftLucent.com                  LucentJobs.com
All rights reserved © 2012-2015 SoftLucent.