[prev] [index] [next]

Pointers

Pointer variables contain memory addresses

Pointers are typed   (know what kind of object they point to)

Using a pointer to access a simple memory object:

int  x, y, *xp;  xp = &x;  *xp = 5;  y = *xp+2;

Using a pointer to access a structured object:

typedef struct { int x; float y; char z; } Rec;

Rec r, *rp;  rp = &r;  (*rp).x = 5;  rp->z = 'm';