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
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 |
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 |
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 |
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 |
Function shall sum members of given one-dimensional array. However, it should sum only members whose number of ones in the binary representation is higher than defined threshold (e.g. if the threshold is 4, number 255 will be counted and 15 will not) - The array length is arbitrary - output the results to the stdout
two variables are added answer is stored on not for third variable how it is possible?
Explain can the sizeof operator be used to tell the size of an array passed to a function?
how to find binary of number?
A global variable when referred to in another file is declared as this a) local variable b) external variable c) constant d) pointers
What is main () in c?
write a program in c language to print your bio-data on the screen by using functions.
write a program to swap Two numbers without using temp variable.
75 Answers EMC, Focus, GreyB, HCL, Hitech, HP, Huawei, Infosys, Mannar Company, Microsoft, Miles Software, Odessa Technologies, Satyam, TCS, Wipro,
What does %c do in c?
Can you please compare array with pointer?
What is data structure in c language?
What is the output for the program given below typedef enum grade{GOOD,BAD,WORST,}BAD; main() { BAD g1; g1=1; printf("%d",g1); }