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 the total generic pointer type?
Write a program to print fibonacci series without using recursion?
What is use of #include in c?
What is a static function in c?
Can a variable be both constant and volatile?
What is return type in c?
How do c compilers work?
Want to know how to write a C program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.
disply the following menu 1.Disply 2.Copy 3.Append; as per the menu do the file operations 4.Exit
Explain what is a const pointer?
write a program that will open the file, count the number of occurences of each word in the the complete works of shakespeare. You will then tabulate this information in another file.
Differentiate between a for loop and a while loop? What are it uses?
What is null in c?
Is a house a shell structure?
Why c is called a mid level programming language?