Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is meant by global static? why we have to use static
variable instead of Global variable

Answer Posted / indira amit

Variables defined local to a function disappear at the end
of the function scope. So when we call the function again,
storage for variables is created and
values are reinitialized. So if we want the value to be
extent throughout the life of a program, we can define the
local variable as "static." Initialization is performed only
at the first call and data is retained between func calls.

Had it been gloal variable, it would have been available
outside the scope of the function, but static variable is
not available outside the scope of a function (helpful in
localizing errors - as it can't be changed outside the func
scope).

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I create a directory? How do I remove a directory (and its contents)?

1222


What is a program flowchart and how does it help in writing a program?

1188


What is the difference between pure virtual function and virtual function?

1179


Should a function contain a return statement if it does not return a value?

1136


When do we get logical errors?

1172


What is string concatenation in c?

1136


Why ca not I do something like this?

1063


Explain enumerated types.

1085


Describe the difference between = and == symbols in c programming?

1453


What is maximum size of array in c?

1084


How can I invoke another program or command and trap its output?

1148


Is a house a mass structure?

1152


What is the right type to use for boolean values in c? Is there a standard type?

1059


Why doesnt this code work?

1123


What does node * mean?

1303