would anyone tell me when we take a variabel suppose int a; is it create a memory space? when we access a variable with oject .variablename how it shows the value .please, tell how it works in respect or RAM.
confusion of storing variable?
Collapse
X
-
Tags: None
-
That is entirely implementation dependent, the C and C++ standards impose no requirements on the way any given platform chooses to store the data it uses in memory.
If you want an answer at the very least you are going to have to give a lot more detail of what you are doing and what you are trying to understand.Comment
-
The C Standard imposes certain minimal constraints, such as a short must be able to hold values in at least the range -32768 to 32767. A compiler is free to do whatever it wants as long as it satisfies the minimal constraints. For example, there is no constraint that compilers must use two's-complement encoding for integers.
The Standard imposes no constraint on the order in which variables are allocated in memory.
The Standard permits union members to overlap in memory, but I don't recall there being a definite requirement to do so. That is, a lazy compiler could choose to treat union as a synonym for struct.
The point is that these sort of details vary widely between compilers. There is no answer that is both general and accurate.
If you want a general answer then you need to say so; if you want an accurate answer then you need to tell us which specific compiler you need an answer for.Comment
Comment