For every type, there is a pointer type. Since there
is an int
type, there is also a pointer-to-int
type, written int *
.
float *
is the pointer-to-float
type. When assigning a pointer value to a variable, or
comparing two pointer values, the types must match. Given
these declarations:
int i, j; float f; int *ip; float *fp;
…then i
is of type
int
,
so the expression &i
must
be of type int *
.
ip
is also of type
int *
,
so you can assign &i
to
it. &j
is of type
int *
,
so it can be compared with &i
, and so on.
But &f
is of type
float *
,
so it cannot be assigned to ip
, or compared with ip
, &i
or
&j
.