User`s manual

Dynamic C Users Manual digi.com 233
Indirection, or multiplication. As a unary operator, it indicates indirection. When used in a declaration, *
indicates that the following item is a pointer. When used as an indirection operator in an expression, * pro-
vides the value at the address specified by a pointer.
int *p; // p is a pointer to an integer
const int j = 45;
p = &j; // p now points to j.
k = *p; // k gets the value to which
// p points, namely 45.
*p = 25; // The integer to which p points gets 25.
// Same as j = 25, since p points to j.
Beware of using uninitialized pointers. Also, the indirection operator can be used in
complex ways.
int *list[10] // array of 10 pointers to integers
int (*list)[10] // pointer to array of 10 integers
float** y; // pointer to a pointer to a float
z = **y; // z gets the value of y
typedef char **stp;
stp my_stuff; // my_stuff is typed char**
As a binary operator, the * indicates multiplication.
a = b * c; // a gets the product of b and c
Divide is a binary operator. Integer division truncates; floating-point division does not.
const int i = 18, const j = 7, k; float x;
k = i / j; // result is 2;
x = (float)i / j; // result is 2.591...
*
/