Thread: d/b extern var & pointer

  1. #1
    Registered User
    Join Date
    Sep 2010
    Posts
    32

    Lightbulb d/b extern var & pointer

    Can you please what is the difference between usage of extern variable and pointer in c.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    extern means the variable is declared in another file.
    A pointer is just a variable whose value is a memory address.


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

  3. #3
    Registered User
    Join Date
    Sep 2010
    Posts
    32
    Thanks, but when we use which(extern var/pointer)?

  4. #4
    Registered User inequity's Avatar
    Join Date
    Nov 2010
    Location
    Seattle, Washington
    Posts
    59
    If you are using a variable that is declared in another file, you can use extern.

    If you have the memory address of a variable, you can use a pointer.

    Post some code if you want us to be more specific.

  5. #5
    Registered User
    Join Date
    Sep 2010
    Posts
    32

    Lightbulb

    Thanks Inequity.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling C in Visual Studio 2005
    By emanresu in forum C Programming
    Replies: 3
    Last Post: 11-16-2009, 04:25 AM
  2. Replies: 0
    Last Post: 03-20-2008, 07:59 AM
  3. Replies: 16
    Last Post: 10-29-2006, 05:04 AM
  4. Direct3D problem
    By cboard_member in forum Game Programming
    Replies: 10
    Last Post: 04-09-2006, 03:36 AM
  5. pointers
    By InvariantLoop in forum C Programming
    Replies: 13
    Last Post: 02-04-2005, 09:32 AM