|
INTERVIEW QUESTIONS
C
VARIABLES IN C
DETAILS
Question: Where does global, static, local, register variables, free memory and C Program instructions get stored?
Answer: local variables-->stack global variable-->data memory register variable-->register static variable-->main memory
|
|
|
Category |
Variables in C Interview Questions & Answers -
Exam Mode /
Learning Mode
|
Rating |
(0.2) By 9481 users |
Added on |
10/12/2012 |
Views |
74121 |
Rate it! |
|
|
Question:
Where does global, static, local, register variables, free memory and C Program instructions get stored?
Answer:
local variables-->stack global variable-->data memory register variable-->register static variable-->main memory Source: CoolInterview.com
Answered by: A.Abdul Jaleel | Date: 10/30/2007
| Contact A.Abdul Jaleel
Local/auto variables, which is declared in stack area of memory
A variable prefixed with register will be stored in registers. when creation of variables exceeds the availability of registers then the remaining register variable will be stored in stack area.
Global variables stored in uninitialised data segment static variables stored in initialised data segment.
free memory(dynamic memory allocatios) will be stored in heap memory(i.e in data segments).
program instrutions will be stored in text segment which will be called ROM(Read only memory).
const variables also stores in text segments Source: CoolInterview.com
Answered by: satish aradhya | Date: 12/5/2007
| Contact satish aradhya
local variables-->stack initialized global variable-->data memory ( .data segment in gcc ) initlaized static variable --> data memory
uninitialized global variable-->data memory ( .BSS( Bolck start by Symbol) segment in gcc ) uninitlaized static variable --> data memory register variable-->register Source: CoolInterview.com
Answered by: pearl | Date: 12/13/2007
| Contact pearl
local-stack global & static -> data segment register->cpu register dynamically allocated->heap Source: CoolInterview.com
Answered by: ravi | Date: 1/2/2008
| Contact ravi
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|
|
Related Questions |
View Answer |
|
1)What is static identifier?
2)Where are the auto variables stored?
|
View Answer
|
|
What is the benefit of using const for declaring constants?
|
View Answer
|
|
What is the difference between declaring a variable and defining a variable?
|
View Answer
|
|
What is an lvalue?
|
View Answer
|
|
Can static variables be declared in a header file?
|
View Answer
|
|
Can a variable be both const and volatile?
|
View Answer
|
|
What is the type of the variable b in the following declaration? #define FLOATPTR float* FLOATPTR a,b;
a) float b) float pointer c) int d) int pointer
|
View Answer
|
|
A switch statement cannot include
a) constants as arguments b) constant expression as arguments c) string as an argument d) None of the above
|
View Answer
|
|
How to swap the content of two variables without a temporary variable
|
View Answer
|
|
Where are the auto variables stored? What is the use of register variables?
|
View Answer
|
|
What is an lvalue?
|
View Answer
|
|
Can a variable be both const and volatile?
|
View Answer
|
|
How can you determine the maximum value that a numeric variable can hold?
|
View Answer
|
|
Is it acceptable to declare/define a variable in a C header?
|
View Answer
|
|
What is the difference between declaring a variable and defining a variable?
|
View Answer
|
|
Can static variables be declared in a header file?
|
View Answer
|
|
What is the benefit of using const for declaring constants?
|
View Answer
|
|
What is the benefit of using #define to declare a constant?
|
View Answer
|
|
What is the benefit of using an enum rather than a #define constant?
|
View Answer
|
|
What is storage class and what are storage variable ?
|
View Answer
|