Oh man, multiple declaration on the single of code is nasty. Passing this kind of advice causes the beginners to develop bad habits.
At least these are not uninitialised variables.
// Shorthands for multiple declarations:
int i1 = 1, i2 = 2;
float f1 = 1.0, f2 = 2.0;
int b, c;
b = c = 0;
Edited:..
After 1hr of posting my original comment, I noticed that there many opinions here.
I should have added why I think this is bad. Readability and maintenance. I would rather it have one line per declaration like the following..
int i1=2;
int i2=2;
Each variable easier to be changed, and reading it is clearer as there are no ambiguity to its type.
A common error I have see from "the multiple declarations in the single line" construct is that changing the type impacts all the variables whereas the intention was only for the first variable.
At least these are not uninitialised variables.
Edited:.. After 1hr of posting my original comment, I noticed that there many opinions here.I should have added why I think this is bad. Readability and maintenance. I would rather it have one line per declaration like the following..
Each variable easier to be changed, and reading it is clearer as there are no ambiguity to its type.A common error I have see from "the multiple declarations in the single line" construct is that changing the type impacts all the variables whereas the intention was only for the first variable.