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

Explain the use of bit fieild.

0 Answers  


what is the full form of c language

9 Answers   Satyam, TCS, VNC,


write the program for prime numbers?

73 Answers   Accenture, Aptech, Infosys, TCS,


can you change name of main()?how?

3 Answers   HCL, Siemens,


Describe the steps to insert data into a singly linked list.

0 Answers  


How can I read and write comma-delimited text?

0 Answers  


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

0 Answers  


What are the applications of c language?

0 Answers  


What is the difference between i++ and i+1 ?(in terms of memory)

3 Answers   HCL,


What is the difference between ‘g’ and “g” in C?

1 Answers  


inline function is there in c language?

4 Answers  


Define a structure to store roll no, name and marks of a student. Using the structure of above write a ‘C’ program to create a file “student.dat”. There must be one record for every student in the file. Accept the data from the user.

0 Answers  


Categories