This seems to be a trivial and is an inherently subjective question but I want to know what the best practice is __with reasons__.
I used to write
char * var ;
But I started writing
char* var ;
Because I thought that the type of var is simply
char* so the * pointer should be stuck to the type so its read in “one eyeful.”
THEN I ran into a bug recently where I didn’t notice that I had declarations
char* var1, var2 ;
And I actually didn’t realize that var2 was type char, not char*. Hmm. Then I thought, well, this way makes the most sense then:
char *var1, *var2 ;
Currently I’m thinking the last way is the correct way now.