In these cases, you have expressions that include a comma operator. The comma operator evaluates its left operand, then its right operand. The result is that of the right operand.
For the moment, let's consider only your last question:
int i=0,j=10;
while(j>0,++i){
printf("%d%d",i,j);
j--;
}
This should not really be an infinite loop, though it may run just a bit longer than expected. Since the result of the comma operator is the result of the right operand, this is waiting for ++i
to become 0. Since it's starting at 0, it's going to cycle though all possible values of an int
before it terminates. With a 16-bit int
, that would probably take a few minutes. With a 32-bit int
, it's going to take quite a bit longer. With a 64-bit int
, it would be an infinite loop for any practical purpose -- I'm pretty sure I'll die long before it could hope to finish at any rate...