Pointer Review
A pointer is an object which references another object.
- The referenced object may also be a pointer.
- int *foo; declares foo as a pointer to an int
- Can have the value NULL.
- void * is a generic pointer.
- unary & references an object
- unary * dereferences an object
- foo->bar is shorthand for (*foo).bar
- pointers to compatible types may be compared with == or !=
- pointers may be compared with NULL or 0
- pointers may be cast to void * and back
next slide