Somehow these pointer arithmetics are very confusing to me. An example:
uint16_t *a = (uint16_t *)0x200;
a += 4 * sizeof(uint32_t);
When calculating the new value of a, what is your thought process?
This is how I am trying to figure it out:
- The pointer (a) points to an address, which has a value of 0x200 of uint16_t type.
- The second operation moves the pointer a to a + 4 * 8 bytes to a location 32 bytes (20 in hex) further up, which is apparently 0x220. How come this is not &a + 32? I think this is where I confuse things... Why is the pointer pointing to 0x200 and not &a?