Linker Error : Undefined symbol 'i' The statement 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.
extern int a; indicates that the variable a is defined elsewhere, usually in a separate source code module.
printf("%d\n", a);it prints the value of local variable int a = 20. Because, whenever there is a conflict between local variable and global variable, local variable gets the highest priority. So it prints 20.
Any pointer size is 2 bytes. (only 16-bit offset) So, char *s1 = 2 bytes. So, char far *s2; = 4 bytes. So, char huge *s3; = 4 bytes. A far, huge pointer has two parts: a 16-bit segment value and a 16-bit offset value.
Since C is a compiler dependent language, it may give different output in other platforms. The above program works fine in Windows (TurboC), but error in Linux (GCC Compiler).