Assigning Numbers to Memory Cells Using Pointers
Learn how to assign numbers to memory locations using pointers.
Pointers to assign numbers
The following sequence of pseudocode is a set of instructions to interpret the contents of the %RAX register as the address of a memory cell and then assign a value to that memory cell:
address a -> rax
1 -> (rax)
Assigning numbers in C and C++
In C and C++, assigning a number is called dereferencing a pointer, and we write:
Assigning numbers in assembly language
In assembly language, we write:
The lea (load effective address) instruction is a method of obtaining an address from one of the Intel processors’ memory addressing modes. It moves the contents of the specified memory address to the destination register. Again, we see movl instead of mov because integers occupy -bit memory cells, and we want to address only a -bit memory cell. When it comes to x64 Linux, memory cells that contain integers are half the size ( ...