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
a c variable cannot start with a) an alphabet b) a number c) a special symbol d) both b and c above
What language is c written?
How many types of arrays are there in c?
Why is this loop always executing once?
Array is an lvalue or not?
What is difference between array and structure in c?
Why are algorithms important in c program?
what is diffrence between linear and binary search in array respect to operators?what kind of operator can be used in both seach methods?
Explain the use of 'auto' keyword
What are derived data types in c?
What is c standard library?
What is a MAC Address?
ATM machine and railway reservation class/object diagram
What is the purpose of sprintf?
Explain Basic concepts of C language?