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

write a progam to display the factors of a given number and disply how many prime numbers are there?

2 Answers  


What is difference between constant pointer and constant variable?

0 Answers   Hexaware,


What is static function in c?

0 Answers  


Can we access RAM? How? Whats the range of access? Similarly What are other hardware we can access?

1 Answers  


wt is d full form of c

6 Answers   TCS, Wipro,






implement general tree using link list

1 Answers   Wipro,


what are bit fields? What is the use of bit fields in a structure declaration?

0 Answers   Flextronics, TISL, Virtusa,


How to set file pointer to beginning c?

0 Answers  


What do you mean by dynamic memory allocation in c?

0 Answers  


why should i select you?

21 Answers   Wipro,


write a c program for greatest of three numbers without using if statment

4 Answers   IBM,


what is out put of the following code? #include class Base { Base() { cout<<"constructor base"; } ~Base() { cout<<"destructor base"; } } class Derived:public Base { Derived() { cout<<"constructor derived"; } ~Derived() { cout<<"destructor derived"; } } void main() { Base *var=new Derived(); delete var; }

3 Answers   Honeywell,


Categories