A simple question: why are you writing
char *foo;
but not
char* foo;
Let me clarify: for me (coming from Java) the ad looks like
<variable-type> <variable-name>;
In the above case, I declare a variable with a footype name char*(since this is a pointer pointing to a char). But wherever I read c / C ++ / C # -Code, it looks like a variable with a *footype name char. The compiler is not interested in spaces, but I as a developer.
tl; dr What I ask is a good explanation for writing char *fooinstead char* foo(which, as explained, seems more convenient to me).
source
share