0
How exactly do variables work?
3 Antworten
+ 1
variables are just names given to a part of the memory, like if you want to take integer values from a user for finding their average, first you have to declare a variable of integer type to hold the values.
+ 1
whenever we declares a variable it allocate a space in memory.
for example: int a;
As soon as compiler reads(compile) this code it allocate a space of 2 byte in memory.
similarly, if we write long q; then compiler allocate a space of 4 byte in memory.
similarly, double b; will allocate 8 byte of memory.
Here a,q and b are names given to that memory .
0
variables allocates different spaces in RAM. So values of them physically stored as ones and zeros