Array Subscripting and Pointers
Manipulating pointers and subscripting arrays both require that you
pay attention to the size of the data.
Incrementing a pointer means having it point to the next adjacent
data item. If the item is a single byte, then you simply add one
to the pointer. But if the item is larger, you must add an amount
to the pointer equal to the number of bytes in the item.
Subscripting an array is similar. Incrementing the subscript means
you are selecting the next adjacent data item. If the items in the
array are bytes, then you simply add the subscript to the starting
address of the array. But if the items in the array are larger, you
must multiply the subscript by the number of bytes per item and then
add it to the starting address of the array.
(Click anywhere to remove this message.)