Static variable and global variable

prem_may10's Avatar, Join Date: Sep 2006
Go4Expert Member
what is static variable, globale variable?

what is the difference between static variable & globale variable

yasodhar premchand
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Try giving a better heading to your queries so that it helps others to search as well as experts can understand it while seeing the title. I have edited the title for this thread.

Static Variable

A variable that exists in only one location and is globally accessible by all instances of a class and also a variable for which memory remains allocated as long as the program executes.

Global Variable

A variable that can be accessed by all parts of a program so it does not belong to any subroutine in particular and can therefore can be accessed from any context in a program