global variable

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • anarghya
    New Member
    • Oct 2006
    • 18

    global variable

    what is the difference between local and global variable?
  • sonic
    New Member
    • Nov 2006
    • 40

    #2
    I am new to C++ so this may not be the best explanation to your question. From my understanding a global variable is one that can be used by the whole program or function; whereas a local variable has a limited scope. A local variable does not share with the whole program.

    Again, this my not be the best explanation, but as members here have helped me, I wish to try and do the same for others.

    Comment

    • DavidJones
      New Member
      • Nov 2006
      • 6

      #3
      Global variables are stored in data segment of memory whereas local variables are stored in stack memory.

      ~David

      Comment

      Working...