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
Is it cc or c in a letter?
When should the volatile modifier be used?
What is the difference between fread and fwrite function?
What is a MAC Address?
What is data type long in c?
I need previous papers of CSC.......plz help out by posting them.......
a c code by using memory allocation for add ,multiply of sprase matrixes
What is volatile variable in c with example?
Explain what is the benefit of using enum to declare a constant?
What are the advantages of using new operator as compared to the function malloc ()?
can any one provide me the notes of data structure for ignou cs-62 paper
Describe how arrays can be passed to a user defined function
Can you pass an entire structure to functions?
What are the advantages of c preprocessor?
What is a stream?