absolutely nothing. They mean the same thing, it's preference where you place the asterisk. I think since the data type (int) is what is being pointed to, the asterisk should be touching it; int* i = 0
Declaring multiple vars on the same line (especially with pointers) is a bad idea.
I agree that it's more clear for the * to be touching the type, since it indicates the type. But of course that's personal preference and there are many who disagree.
Throwing my opinion out; I prefer the asterisk to be touching the variable name. The way I was able to wrap my mind around it in the beginning was thinking of int as the type, and the variable as the pointer - so the asterisk should be touching the variable. I sort of stuck with that ever since.
Disch wrote:
Declaring multiple vars on the same line (especially with pointers) is a bad idea.
Is this for any reason other than readability? Curious.
The way I was able to wrap my mind around it in the beginning was thinking of int as the type, and the variable as the pointer
That doesn't really make sense though. If the variable is a pointer, then that means the type is a pointer. If the type is an int, then you don't have a pointer.
Is this for any reason other than readability?
Nope. Just readabilty. Mainly for the reason booradly60 mentioned.