You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.3 KiB

main() begin
XXXX = 111111111
XXXX is stored at &XXXX = 0xfffff40750e0
YYYY is a pointer to XXXX: YYYY = 0xfffff40750e0
* dereferences the pointer: *YYYY = 111111111
Array AAAA can be accessed with array notaions:
AAAA[0] = 222222222
AAAA[1] = 333333333
AAAA[2] = 444444444
Array variable AAAA is a pointer to A[0]: AAAA = 0xfffff40750f8
So, dereferencing AAAA should give us A[0]: *AAAA = 222222222
Adding 1 to an int pointer makes it point to the next int
AAAA = 0xfffff40750f8
AAAA+1 = 0xfffff40750fc
*(AAAA+1) = 333333333
We can look at contents of a chunk of memory:
Peeking at the memory in the neighbourhood of &XXXX, we see:
Address Contents in Hex Contents in Decimal
0xfffff40750fc: 13de4355 = 333333333
0xfffff40750f8: d3ed78e = 222222222
0xfffff40750f4: ffff = 65535
0xfffff40750f0: f40750e0 = -200847136
0xfffff40750ec: ffff = 65535
0xfffff40750e8: f40750e8 = -200847128
0xfffff40750e4: 6 = 6
0xfffff40750e0: 69f6bc7 = 111111111
0xfffff40750dc: ffff = 65535
0xfffff40750d8: a478f4e0 = -1535576864
0xfffff40750d4: aaaa = 43690
0xfffff40750d0: c46a13e0 = -999681056
0xfffff40750cc: ffff = 65535
0xfffff40750c8: a478f538 = -1535576776
0xfffff40750c4: ffff = 65535
main() ends