C
Chad
The following question stems from p.132 in the book "The C Programming
Language", second edition by K & R.
The have
struct {
int len;
char *str;
} *p;
The question is how come parentheses are need when you go like:
(++p)->len;
but you don't need them when you go:
p++->len;
The only thing I can think of would be that in the former, the prefix
operator associates right to left,
whereas in the former, the postfix operator associates left to right.
I'm I close?
Chad
Language", second edition by K & R.
The have
struct {
int len;
char *str;
} *p;
The question is how come parentheses are need when you go like:
(++p)->len;
but you don't need them when you go:
p++->len;
The only thing I can think of would be that in the former, the prefix
operator associates right to left,
whereas in the former, the postfix operator associates left to right.
I'm I close?
Chad