Address arithmetic
- If p is a pointer to some element of an array, then p++ increments p to point to the next element, and p += i increments it to point i elements beyond where it currently does.
- A pointer and an integer may be added or subtracted.
- It is not legal to add two pointers, or to multiply or divide or shift or mask, or to add float or double.
- It is illegal to assign a pointer of one type to a pointer of another type without a cast.
- If p and q point to members of the same array, then subtraction is valid, e.g.,
q - (p+1) is the number of elements from p to q.
- If p and q point to members of the same array, then relations like ==, !=, <, >, etc., work properly.
- Any pointer can be meaningfully compared for equality or inequality with zero.