type *var -- vs. -- type* var
Jeff Lewis
lewie at pur-ee.UUCP
Sat Sep 9 06:18:08 AEST 1989
Regarding declarations of pointers x, y and z, and question of why
'int* x, y, z' doesn't do what's 'intuitive':
>That's because "*" binds more tightly than ",". If you want to force
>a particular grouping, use parentheses:
>
> (int *) x, y, z
>
'(int *) x' is a cast, not a declaration. Compiling the above yields
errors about x, y and z being undeclared. Because there's no explicit
separator between declarations and statements, you'll never be able
to declare pointers as such. Isn't C syntax fun?
--
Jeff Lewis (lewie at ee.ecn.purdue.edu, pur-ee!lewie)
More information about the Comp.lang.c
mailing list