3 ms·
Also, we have int *p, q; which says "p is a pointer to integer; q is an integer". That's an argument against writing int* p, q; because that suggests th
by Someone 10y ago
Also, we have
int *p, q;
which says "p is a pointer to integer; q is an integer". That's an argument against writing
int* p, q;
because that suggests that both p and q are pointers to integer.
And yes, you can write (IIRC)
int q, *p;
(See also http://www.stroustrup.com/bs_faq2.html#whitespace http://www.stroustrup.com/bs_faq2.html#whitespace)
- dllthomas 10y agoYRC
- Avernar 10y agoThat's why I declare pointer variables one to a line. Wish the language would work the other way with the asterisk associativity. Mainly because this just looks wrong to me: int *p, *q; typedef int *intp; intp p, q; That just screams that the * belongs to the type and not the variable name.