Memory allocation of variables declared in a program is ------
a) Allocated in RAM
b) Allocated in ROM
c) Allocated in stack
d) Assigned in registers.
which one is correct please tell me the answer in 24 hrs...

In RAM .... Is this a homewrk?

Memory allocation of variables declared in a program is ------
a) Allocated in RAM
b) Allocated in ROM
c) Allocated in stack
d) Assigned in registers.
which one is correct please tell me the answer in 24 hrs...

both a and c are correct in a way. Memory allocation of variables is logically stored on the stack which in turn is physically stored on RAM although there is no stack structure whilst stored in RAM. Sometimes d is also right.

If optimization needs to be performed then the same variable might get a place in the register.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.