looks as if it's declaring two pointers, when it's really doing the same thing as above.
answered Apr 8, 2011 at 3:39 user541686 user541686 209k 133 133 gold badges 550 550 silver badges 914 914 bronze badgesSimilarly for types appearing in function declarations.
int* f(), g(); // declares int g(); int *h(), (*i)(); // i is pointer to function returning int int *const*m(), n(); // m returns pointer to (const-pointer to int) // n returns int
. but at least function arguments can't get so hairy - the type specification starts afresh after each comma separators.
Summarily, int *p is better if your coding style / code-base utilises multiple declarations on a single line of source code, otherwise int* p offers a clearer separation of type and the following identifier.
For all that, people's preferences are largely based on what they're used to.