char* a
char *a
char* a, b, c;
char *a, b, c;
vlad from moscow wrote: |
---|
In the West many programmers have no own brain |
There are more zombies in the West, you see. |
short
or unsigned
before a list of variable declarations? Is the first one a short
, and the rest int
's? Does the same thing apply to const
& static
or any other qualifier? I have a sneaking suspicion that it does.char* a;
char *a;
Most of the time, I declare only one pointer/reference/etc per line, and it simply shows you instantly what type you are using. In the end, it's char* type. I like it that way. Do as you prefer. Compiler won't mind. |
char* a, b, c;
issue is a weird inconsistency of C that's been inherited by C++. In most contexts in C/C++, char*
is treated syntactically as a type in the same way as, say, char
would. Writing char* a
separates the type from the variable name in a natural way.char* a, b, c;
gotcha, but, like MatthewRock, I tend to declare one variable per line, so it's never an issue for me.char *a, b, c;