Thread: extern

  1. #1
    Registered User
    Join Date
    May 2002
    Posts
    17

    extern

    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

  2. #2
    Im back! shaik786's Avatar
    Join Date
    Jun 2002
    Location
    Bangalore, India
    Posts
    345
    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.

  3. #3
    Registered User
    Join Date
    Jul 2002
    Posts
    13

    all abt extern

    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

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. extern classes
    By Swordsman in forum C++ Programming
    Replies: 1
    Last Post: 05-07-2008, 02:07 AM
  2. Replies: 16
    Last Post: 10-29-2006, 05:04 AM
  3. Odd Problem with Linking
    By jamez05 in forum C++ Programming
    Replies: 6
    Last Post: 09-21-2005, 01:49 PM
  4. Extern Question, really confused
    By SourceCode in forum C Programming
    Replies: 10
    Last Post: 03-26-2003, 11:11 PM
  5. extern symbols, what do these mean exactly?
    By Shadow12345 in forum C++ Programming
    Replies: 8
    Last Post: 11-02-2002, 03:14 PM