FA> -=> Quoting Paul Edwards to All <=-
PE> int *x;
PE> int y;
PE> y = 3 * x;
PE> y = * x;
PE> y = *x;
PE> Which ones do you reckon are legal? I am wondering how mulitplication
PE> and indirection are distinguished between. Is the space significant?
FA> Paul, i am shocked ! Pointers can't be multiplied !?
I wasn't actually aware that they couldn't be multiplied. But
I suppose with all the warnings I've seen about suspicious
pointer conversion, which was a pointer being used as an integer
somewhere, that maybe it can't be used as an integer after all.
I am used to pointers being integers, and knowing how C likes to
let you do anything, I would have thought you could do something
like that!
Come to think of it, I think I remember something about pointers
not being allowed to be divided either. But there is certainly
a reason to want to do that.
E.g.
char *start;
char *end;
char *middle;
middle = (start + end) / 2;
I think I remember reading that you had to go:
middle = start + (end - start) / 2;
BFN. Paul.
@EOT:
---
* Origin: X (3:711/934.9)
|