[prev] [index] [next]

Aside: Pointer Arithmetic

A pointer variable holds a value which is an address.

C knows what type of object is being pointed to

  • it knows the sizeof that object
  • it can compute where the next/previous object is located
Example:

int a[6];   // address 0x1000
int *p;
p = &a[0];  // p contains 0x1000
p = p + 1;  // p now contains 0x1004