Linker error and extern in c/c++

main()
{
extern int k;
k=20;
printf(“%d”,k);}
Tutorial answer:Linker error;Underfined symbol ‘_i’;
Debugger solution:Extern storage class in the following declaration
Extern int i;
Extern keyword refer to there memory their allocation in the some other program and there address is give to current prg.In these case linker detect any other variable of specify name i is persent in other prg.so it generate linker error

Post a Comment

0 Comments