First thing first, never declare multiple pointer variables in same declaration statement. Don’t mix declaration of pointer and non-pointer variables in same line. Following this will save you a lot of debugging time in the future.
But in case, you are forced do it or you are debugging code written by somebody else, this short post can help you.
What does this code really mean?
int* c, d;
It is clear that c is a pointer to integer. But what about d? Is it integer or pointer to integer? Ofcourse, it is integer not a pointer to integer. Using declaration as above is very ambigious. Avoid it any cost. Instead, declare them on their own statements.
int* c; int d;
Much clear. Isn’t it?
It is also better to follow this rule when all variables are pointers. Also, I prefer to put the star next to varaible name instead of the variable type.
int *p, *q;
is more intuitive than
int* p, *q;