extern variable

This is a discussion on extern variable within the C Programming forums, part of the General Programming Boards category; if a variable is declared as extern, for example extern int x; but it is not declared any where in ...

  1. #1
    Registered User
    Join Date
    Feb 2008
    Posts
    146

    extern variable

    if a variable is declared as extern, for example
    extern int x;

    but it is not declared any where in any file then what will happen? Will x be allocated memory?

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Why don't you try it and find out?


    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    The linker will hit you on the head and wish you knew what you were doing.

  4. #4
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Or you can just wait and someone will come along and answer it...


    Quzah.
    Hope is the first step on the road to disappointment.

  5. #5
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    If he has to ask the question, he may not even understand what I told him. Besides, he doesn't know if I'm telling the truth.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need some help...
    By darkconvoy in forum C Programming
    Replies: 32
    Last Post: 04-29-2008, 04:33 PM
  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, 02:49 PM
  4. Headers that use each other
    By nickname_changed in forum C++ Programming
    Replies: 7
    Last Post: 10-03-2003, 05:25 AM
  5. float/double variable storage and precision
    By cjschw in forum C++ Programming
    Replies: 4
    Last Post: 07-28-2003, 07:23 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21