What actually happens in C when a value is stored without a pointer?

IMPORTANT: This question tried to ask too many things right away and ultimately failed. Rewritten question here: How are variables related to their values ​​in C?


Consider what the value is 4at the address 0001, and then we assign the address to the 0001variable num. We could visualize this as two tables:

VARIABLE|ADDRESS    ADDRESS|VALUE
num     |0001       0001   |4

From what I understand, this will be the final product of the following code:

int temp = 4;
int * num = &temp;

However, what happens on the first line int temp = 4;,? Does this first line produce something like this?

VARIABLE|ADDRESS    ADDRESS|VALUE
        |           temp   |4

And how do pointers to pointers work? Will the code:

int temp = 4;
int * num = &temp;
int ** pnum = #

produce it?

VARIABLE|ADDRESS    ADDRESS|VALUE
num     |0001       0001   |4
pnum    |0002       0002   |0001

? ? , ?

, , , ; .

EDIT: , , , , , , , , , , - . , , , , , , , , . , , , , , ?

-2
1

, , . () , eax, ebx r1, r2. CPU, .

(8 ( ) x86-64, 256 IA64...), () , . ( esp, ) ( ), , , .

, , , mov , . , . (L1: inst cache- > fetcher- > CPU pipe- > mov- > STORE pipe- > L1: )

, .

+1

Source: https://habr.com/ru/post/1695249/


All Articles