,
Share with your friends 

What wil be out put:-

5 ratings Views 126 
Author: vikas_b6a788d7 (vikas saini)  View Profile |  View other solutions by this author

Question / Problem


How to work extern keyword?

Solution

     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 .



Applies to

C

Rank It

Login to rank it

Report


Advertisement