[sdiy] Pointers in C

Olivier Gillet ol.gillet at gmail.com
Sat Dec 31 14:09:12 CET 2011


> If you want to access individual bytes, you can just add 1 (or 2 or 3...) to the pointer.

Any operation on pointer is relative to its size ; so x += 1 where x
points to a 32-bits int will actually increment the address stored in
x by 4. This is so to make things consistent with array indexing -
array access and pointer dereference are really the same thing...

x[i + 4] is equivalent to *(x + i + 4)

http://www.cplusplus.com/doc/tutorial/pointers/ (C++ but applies to C).

Olivier



More information about the Synth-diy mailing list