Logo 
Search:

C Programming FAQ

Submit Interview FAQ
Home » Interview FAQ » C ProgrammingRSS Feeds

C programming practical question 6

  Shared By: Adah Miller    Date: Jan 24    Category: C Programming    Views: 164

Answer:

main()
{
extern int i;
i=20;
printf("%d",i);
}


Answer:
Linker Error : Undefined symbol '_i'


Explanation:
extern storage class in the following declaration,
extern int i;
specifies to the compiler that the memory for i is allocated in some other program and that address will be given to the current program at the time of linking. But linker finds that no other variable of name i is available in any other program with memory space allocated for it. Hence a linker error has occurred .

Share: 
 

Didn't find what you were looking for? Find more on C programming practical question 6 Or get search suggestion and latest updates.


Your Comment
  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].


Tagged: