I am learning c++. What I don't understand is how a variable is actually initialized.
Consider the following:
int x = 1;
This is what I assume about the whole initialization process:
There are different parts of memory that are only responsible for storing a certain type of memory.
First a part of the memory responsible for storing int type are freed up to store the binary format of 1 as 00000000 00000000 00000000 00000001(32 bits). The address of this is lets say 0111.
Then a part of the memory responsible for storing variable names are freed up and the string "x" is stored in binary format, together with the address 0111.
So every time when the variable x is called, the computer searches for the string "x" in the part of memory responsible for storing variable names. Then it retrieves the address information of 0111 and get the int 1 in the part of memory responsible for storing int type.
So is the assumption correct? Or else what is the actual initialization process happening inside the computer?
Thanks.