Why does this use of comma work in a expression but fail in a declaration?
Am from high level OOP languages C# and Java and recently started scratching my head in C. I feel C a bit weird as equally as one feels JS is. So want to clarify below: Below gives error and that seems intuitive as it looks like incorrect syntax even in OOP languages int i=0,1,2; /* Error : expected identifier or ‘(’ before numeric constant int i = 0, 1, 2; ^ */ However below works surprisingly: int i; i = 0,1,2; //works Why is this behavior? Is their any significance to keep such behavior or just some parsing technicalities? This is actually a tricky question because it relies on the details