answersLogoWhite

0


Best Answer

It depends entirely on what platform you are using.

In an embedded environment, for instance

global/static variables go into different RAM memory segments depending on whether or not they are initialised.

constants are often left in ROM

automatic variables are normally placed of the stack of the currently running task but not always.

User Avatar

Wiki User

15y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

11y ago

constant variables are not stored anywhere..where ever they r present in the program the compilier at compilation time replaces these varibles by their values...however the local variables are stored in stack memory & global and static variables are stored in data segement of the program....

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

The Variable will be stored in main memory, if at the time of declaration it is not preceded by any keyword. This is because it will be an auto variable and all the auto variable are stored in main memory. The variable that is stored other than main memory is register variable (stored in register, that is why it is called so.)

When you precede a variable by the keyword register, it means you are making a request, it might be or might not stored in the register.

This answer is:
User Avatar

User Avatar

Wiki User

9y ago

A constant in mathematical term is a value represented by a character whose value is unchangeable in all conditions. In c programming the constant is a value stored in a variable which is unchangeable throughout the program.

This answer is:
User Avatar

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

User Avatar

Wiki User

13y ago

Main memory (RAM).

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

Main memory (RAM).

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Where does global variables stored in C?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Where does global static local register variables free memory and C Program instructions get stored?

* These are all implementation defined. Access to `register' specified indentifiers should be as fast as possible, so the compiler may place the value in a machine register. However, the compiler is free to treat a `register' declaration as an `auto' declaration. * Where free memory is maintained is an OS specific concept. Instructions are generally stored in code segement. Local Variables are stored in Stack. Register variables are stored in Register. Global & static variables are stored in data segment. The memory created dynamically are stored in Heap And the C program instructions get stored in code segment.


Are C variables initialized to 0 by default?

Only global/static variables are, local variables aren't.


What is the storage allocation and scope of global extern static local and register variables?

AnswerLocal Variables are stored in Stack. Register variables are stored in Register. Global variables are stored in data segment. The memory created dynamically are stored in Heap And the C program instructions get stored in code segment and the extern variables also stored in data segment. Nooo NoooStatic variable will be stored in .BSS segment... (Block Started By Symbol)


When an array is declared does c automatically initializes its elements to zero?

For global/static variables: yes.For auto variables: no.


What are the differences between C and Java reference variables?

Java does not have the concept of Reference Variables. We cannot access the memory location where the data is stored in Java.

Related questions

Is global variables are stored in registers?

They is not.


Global variables are stored in?

Main memory (RAM).


Where does global static local register variables free memory and C Program instructions get stored?

* These are all implementation defined. Access to `register' specified indentifiers should be as fast as possible, so the compiler may place the value in a machine register. However, the compiler is free to treat a `register' declaration as an `auto' declaration. * Where free memory is maintained is an OS specific concept. Instructions are generally stored in code segement. Local Variables are stored in Stack. Register variables are stored in Register. Global & static variables are stored in data segment. The memory created dynamically are stored in Heap And the C program instructions get stored in code segment.


Where local variables are stored in c?

On the stack.


Are C variables initialized to 0 by default?

Only global/static variables are, local variables aren't.


What is the storage allocation and scope of global extern static local and register variables?

AnswerLocal Variables are stored in Stack. Register variables are stored in Register. Global variables are stored in data segment. The memory created dynamically are stored in Heap And the C program instructions get stored in code segment and the extern variables also stored in data segment. Nooo NoooStatic variable will be stored in .BSS segment... (Block Started By Symbol)


What are the differences between global variables and local variables in C plus plus?

Global variables can be seen in all blocks of your program, when local variables are visible only within the block where it's declared.


What are the value and preference of global variable?

Global variables can have any value, in C they are aumaticatically initialized to zero.


When an array is declared does c automatically initializes its elements to zero?

For global/static variables: yes.For auto variables: no.


What are global variables in c?

The ones that are declared outside any functions and don't have modifier static.


Where auto variables are stored?

Auto variables are stored on the stack alongside all other local variables.


What are the differences between C and Java reference variables?

Java does not have the concept of Reference Variables. We cannot access the memory location where the data is stored in Java.