New answers tagged

3

While the answer of user123 covers a number of the technicalities well, I think a small memory illustration may be useful. You can generally think of a pointer as an index into physical memory. Let's see a little bit of what that might look like: Empty Memory: [####][####][####][####][####][####][####][####] 64      68       72      76      80      84      ...


6

In general, a pointer is a variable which holds the address of a variable. You can use https://godbolt.org/ to find out the assembly equivalent of a pointer. For example, void func(){ int* pointer; int a = 3; pointer = &a; } compiles to pushq %rbp movq %rsp, %rbp movl $3, -12(%rbp) leaq -12(%rbp), %rax movq %rax, -8(%rbp) nop ...


Top 50 recent answers are included