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

Answers were Sorted based on User's Feedback



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

Answer / guest

Static is protected one and you cannot acess the variable
in other files/functions.It is declared in the top of the
file/function.The value retains tho,t the program.

Is This Answer Correct ?    6 Yes 0 No

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

Answer / vaibhav

global static means the static value declared as a
global.using this we can share same copy of that variable.

Is This Answer Correct ?    1 Yes 1 No

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

Answer / 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

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

Answer / abdur rab

Static remains throughout the program, however its scope is
limited to that file alone. If a program consists of
multiple files, you want a variable to be seen by the
entire file and do not want that variable to be seen by the
other files, then mark is as static

static int a;

as a global variable

Is This Answer Correct ?    2 Yes 3 No

Post New Answer

More C Interview Questions

Explain high-order bytes.

0 Answers  


What is the purpose of macro in C language?

0 Answers   Fidelity,


What is meant by errors and debugging?

0 Answers  


When should the volatile modifier be used?

0 Answers  


What is c language & why it is used?

0 Answers  


What are runtime error?

0 Answers  


There are 8 billiard balls, and one of them is slightly heavier, but the only way to tell was by putting it on a weighing scale against another. What's the fewest number of times you'd have to use the scale to find the heavier ball?

5 Answers   Microsoft, TCS,


main() { printf("hello%d",print("QUARK test?")); }

5 Answers  


What are the standard predefined macros?

0 Answers  


how to find the size of the data type like int,float without using the sizeof operator?

13 Answers  


What is an identifier?

0 Answers  


My teacher ask to make a program that can: Insert record in front Insert record at the end Insert in between Search node record Delete record in front Delete record at the end Delete record in between Using Data structure Linked List type. But I'm really confused about the codes and I can't go through. Please help Thanks in advance. Also here is my unfinished code if someone can make changes it will be more good.

1 Answers  


Categories