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
What is c++ used for today?
Why C language is a procedural language?
What is volatile c?
What does it mean when a pointer is used in an if statement?
Explain 'bit masking'?
Why doesnt long int work?
What is the heap in c?
Why does everyone say not to use gets?
Explain the use of #pragma exit?
Write a program to check palindrome number in c programming?
What are unions in c?
Can a file other than a .h file be included with #include?
what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;
What is New modifiers?
There is a practice in coding to keep some code blocks in comment symbols than delete it when debugging. How this affect when debugging?