what is diff between localstatic and globalstatis variable
possible 2 use in another file...?

Answers were Sorted based on User's Feedback



what is diff between localstatic and globalstatis variable possible 2 use in another file...?..

Answer / abdur rab

Local Static
============
The scope of the variable is only within the function where
it is declared, throughout the program. ie the value is
preserved until the end of the program.


Global Static
=============
The scope of the variable is only within the file where it
is declared, throughout the program. ie the value is
preserved until the end of the program.

Global Static variables are not visible outside the files
where they are declared.

Is This Answer Correct ?    8 Yes 0 No

what is diff between localstatic and globalstatis variable possible 2 use in another file...?..

Answer / guest

localstatic belong to that only that function .
globalestatic belong 2whole file. not possible.

Is This Answer Correct ?    6 Yes 1 No

Post New Answer

More C Interview Questions

cin.ignore(80, _ _);This statement a) ignores all input b) ignores the first 80 characters in the input c) ignores all input till end-of-line d) iteration

0 Answers  


What is zero based addressing?

0 Answers  


Using functions, write a program that multiplies two arrays. Use the following functions: - Function ReadArray - Function MultiplyArrays - Function DisplayArrays

0 Answers  


Evaluate the following: int fn(int v) { if(v==1 || v==0) return 1; if(v%2==0) return fn(v/2)+2; else return fn(v-1)+3; } for fn(7); 1) 10 2) 11 3) 1

6 Answers  


how to get starting address of a running C program

3 Answers  


main() {int i=5; // line 1 i=(++i)/(i++); // line 2 printf("%d",i); // line 3 } output is 2 but if we replace line 2 and line 3 by printf("%d",i=(++i)/(i++)); then output is 1. Why?

1 Answers   GATE,


#include<stdio.h> int f(int,int); int main() { printf("%d",f(20,1)); return 0; } int f(int n,int k) { if(n==0) return 0; else if(n%2)return f(n/2,2*k)+k; else return f(n/2,2*k)-k; } how this program is working and generating output as 9....?

1 Answers  


int i=0,j; j=++i + ++i ++i; printf(" %d",j);

2 Answers   ME,


How does memset() work in C?

2 Answers  


how to generate the length of a string without using len funtion?

4 Answers  


struct tag{ auto int x; static int y; };main() { struct tag s; s.x=4; s.y=5; printf(ā€œ%dā€,s.x); }

2 Answers   Vector,


What is huge pointer in c?

0 Answers  


Categories