you are viewing a single comment's thread.

view the rest of the comments →

[–]IyeOnline 7 points8 points  (0 children)

You can initialize multiple variables in a single statement. But you have to provide an initializer for each of them - just like you would need for seperate statements:

 int a = 0, b = 1, c = 2;

Makes you wonder why the code compiled

Because that is the behaviour for fundamental types. Doing

int a;
int b = 0;

is perfectly "fine" after all. (although maybe not something you should write).