what is the difference between global variable & static
variable declared out side all the function in the file.

Answers were Sorted based on User's Feedback



what is the difference between global variable & static variable declared out side all the func..

Answer / vishnu

Both the variables are stored in data segment but difference
is in accessing the variable. Global variables can be
accessed though out the project (if multiple files exists)
whereas static variable accessed within the file where its
declared.

Is This Answer Correct ?    15 Yes 2 No

what is the difference between global variable & static variable declared out side all the func..

Answer / ashwinishaligram308

global variableis allocated on heap and static variables on
stack

Is This Answer Correct ?    2 Yes 11 No

Post New Answer

More C Interview Questions

How do i store a paragraph into a string? for example, if i input a long paragraph, the program will read the words one by one and concatenate them until no word is left.

1 Answers  


Is c easy to learn?

0 Answers  


how do you programme Carrier Sense Multiple Access

0 Answers  


what is the maximum no. of bytes calloc can allocate

4 Answers   Mphasis,


Method Overloading exist in c ?

3 Answers   Wipro,


Can you please explain the difference between syntax vs logical error?

0 Answers  


What is return in c programming?

0 Answers  


typedef struct{ char *; nodeptr next; } * nodeptr ; What does nodeptr stand for?

0 Answers   Wilco,


What is meant by operator precedence?

0 Answers  


Tell us the use of fflush() function in c language?

0 Answers  


a simple program in c language

5 Answers   IBM,


How the processor registers can be used in C ?

7 Answers   HP,


Categories