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

What is data structure in c programming?

0 Answers  


write a c program to print the next of a particular no without using the arithmetic operator or looping statements?

1 Answers   TCS,


what will be the output of this program? #include<stdio.h> #define cube(x) x*x*x void main() { int i,j=5; i=cube(j+3); printf("i=%d",i); }

6 Answers   IBM,


When is a “switch” statement preferable over an “if” statement?

0 Answers  


FILE *fp1,*fp2; fp1=fopen("one","w") fp2=fopen("one","w") fputc('A',fp1) fputc('B',fp2) fclose(fp1) fclose(fp2)} a.error b. c. d.

0 Answers   Wilco,






What is the purpose of macro in C language?

0 Answers   Fidelity,


Lists the benefits of c programming language?

0 Answers  


What is the output of the following program #include<stdio.h> main() { int i=0; fork(); printf("%d",i++); fork(); printf("%d",i++); fork(); wait(); }

8 Answers   ADITI, Adobe,


What is the size of array float a(10)?

0 Answers  


is it possible to change the default calling convention in c ?

1 Answers   Aptech,


What is the difference between test design and test case design?

0 Answers  


What is bin sh c?

0 Answers  


Categories