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

write a program to print infinte number

4 Answers  


Why dont c comments nest?

0 Answers  


Can you assign a different address to an array tag?

0 Answers  


How can I determine whether a machines byte order is big-endian or little-endian?

0 Answers  


What are the types of data files?

0 Answers  






what is the disadvantage of using macros?

1 Answers   Wipro,


Is python a c language?

0 Answers  


Would you rather wait for the results of a quicksort, a linear search, or a bubble sort on a 200000 element array? 1) Quicksort 2) Linear Search 3) Bubble Sort

3 Answers  


In c programming, explain how do you insert quote characters (? And ?) Into the output screen?

0 Answers  


What is Dynamic memory allocation in C? Name the dynamic allocation functions.

1 Answers  


Why is the code below functioning. According to me it MUST NOT.

1 Answers  


The __________ attribute is used to announce variables based on definitions of columns in a table?

0 Answers  


Categories