Where to put the star in C and C++ pointer notation
Posted
by
Martin Kristiansen
on Stack Overflow
See other posts from Stack Overflow
or by Martin Kristiansen
Published on 2012-12-15T16:59:00Z
Indexed on
2012/12/15
17:03 UTC
Read the original article
Hit count: 151
For some time the following has been annoing 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?
© Stack Overflow or respective owner