vrijdag 22 juni 2007

arr[i] and &arr[i]

arr[i] == *(arr + i) // values in two notations
&arr[i] == arr + i // addresses in two notations

Remember that adding one to a pointer, including an array name, actually adds a value equal to the size, in bytes, of the type to which the pointer points.
Pointer addition and array subscription are two equivalent ways of counting elements from the beginning of an array.

Geen opmerkingen: