> We bind type modifiers and qualifiers to the left.
Good idea in theory but your example shows how bad it behaves in practice.
Good idea in theory but your example shows how bad it behaves in practice.
char* var1;
char var2;
char var2, *var1;
is valid C while in Java this would be illegal char var2, [] var1;
So the syntax is correct and all you are doing is to add style rules that make it less readable.That said, I understand the differences in traditions.
I think that C's syntax is flexible that we can each go to our own, and decide which is more readable.
typedef char * pchar;
pchar var1, var2; // Now they're both pointers
I'm not really a fan, but it can address the problem.char var1[10];
and not
char[10] var1;
The rule is simple once you understand it, variables are declared with the same syntax that is used to access it later.