Hi,
When you see code like this in C, what's the order of assignment?
int i = 0, var1, var2;
I don't understand the syntax...
Hi,
When you see code like this in C, what's the order of assignment?
int i = 0, var1, var2;
I don't understand the syntax...
Only i
is assigned the value zero.
var1
and var2
are uninitialized.
i
is initialized to 0
whereas variables var1
and var2
are uninitialized and thus have unspecified values(if they are defined in a local scope).
There's no "assignment" in your code whatsoever. It is a declaration of three variables of type int
, of which one is initialized with zero. The =
symbol is an integral part of initialization syntax, it has nothing to do with any "assignment". And since there's only one initialization there, there's really no question about any "order".
If that doesn't answer your question, clarify it.