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

What is pass by reference in functions?

0 Answers  


Why structure is used in c?

0 Answers  


hi , please send me NIC written test papers to sbabavalli@gmail.com

0 Answers   NIC,


a memory of 20 bytes is allocated to a string declared as char *s then the following two statements are executed: s="Etrance" l=strlen(s); what is the value of l ? a.20 b.8 c.9 d.21

4 Answers   TCS,


State the difference between x3 and x[3].

0 Answers   Aricent,


main() { printf(5+"Vidyarthi Computers"); }

6 Answers  


If "AaBbCc" is passed to the char char x(*a) { a[0]?x(a+1):1; printf("%c",a[0]); return 1; } what will be the output?

6 Answers   Hughes,


Where we use clrscr in c?

0 Answers  


How can I ensure that integer arithmetic doesnt overflow?

0 Answers  


How can I automatically locate a programs configuration files in the same directory as the executable?

0 Answers  


code for reverse alternate words from astring

1 Answers   IBM,


Why malloc is faster than calloc?

0 Answers  


Categories