hello guys,
what is the "extern" do ,what's the purpose of that and where we have to use this .
thank u
bye
srinu
hello guys,
what is the "extern" do ,what's the purpose of that and where we have to use this .
thank u
bye
srinu
srinu
extern are variables/functions declared in one file, which can be accessed in another.
Best example is the variable errno which has been defined in the header file errno.h, but is modified by so many standard functions libraries to indicate an error.
hope this will help u
suppose i have 2 C files A and B
i have a variable declared as "int x " in A. and i need to access it from B.
then i declare it as "extern int x" in B and link file B to A at link time. then i can access variable x from A also
hope this has made ur funda clear