3 ms·
I only declare multiple variables in one line if it is a "simple" type, without pointers, arrays, functions, etc. Also, a code such as: int*x=y; will defin
by zzo38computer 2y ago
I only declare multiple variables in one line if it is a "simple" type, without pointers, arrays, functions, etc.
Also, a code such as:
int*x=y;
will define the initial value of x and not of *x. For this reason, a space before the asterisk can be confusing in this way. And, for the reasons described in another comment, putting the space after the asterisk is also confusing. So, I find it clearer to omit both spaces.
When I require more complicated types, I will generally use typedef (or typeof) instead of having to deal with the confusing syntax of types in C.