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 difference between array of characters and string

18 Answers   Accenture, Nest,


Write a program that accept anumber in words

0 Answers  


Explain union.

0 Answers  


What is assert and when would I use it?

0 Answers  


Does sprintf put null character?

0 Answers  






What is the general form of a C program?

0 Answers  


Differentiate call by value and call by reference?

0 Answers   Cyient,


Write a program or provide a pseudo code to flip the 2nd bit of the 32 bit number ! (Phone Screen)

1 Answers   NetApp, PTU, Wipro,


Explain can the sizeof operator be used to tell the size of an array passed to a function?

0 Answers  


hi friends how r u as soon in satyam my interview is start but i m very confusued ta wat i do plz help me frndz wat can i do plz tell me some question and answers related with "C" which r asked in the interview .

0 Answers   Aegis, CDAC, Infosys,


Add Two Numbers Without Using the Addition Operator

0 Answers  


using only #include <stdio.h> and #include <stdlib.h> Write a program in C that will read an input from the user and print it back to the user if it is a palindrome. The string ends when it encounters a whitespace. The input string is at most 30 characters. Assume the string has no spaces and distinguish between and lowercase. So madam is a palindrome, but MadAm is not a palindrome. Use scanf and %s to read the string. Sample Test: Enter a string: madam madam is a palindrome. Enter a string: 09023 09023 is not a palindrome.

0 Answers  


Categories