Possible Duplicate:
Correct way of declaring pointer variables in C/C++
For some time the following has been annoying me, where should I put the star in my pointer notation.
int *var; // 1
and
int* var; // 2
obviously do the same thing, and both notations are correct, but I find that most literature and code I look at use the 1th notation.
wouldn’t it be more ‘correct’ to use the 2th notation, separating the type and the variable name by a whitespace, rather than mixing the type and variable tokens?
No. Never.
<g>But consider:
Here, the placement of the
*is misleading, because it does not apply tovar2, which is anintand not anint*.