comma separated expression in while loop in C

I never saw such a while statement before.

while(printf("> "), fgets(str, 100, stdin), !feof(stdin)) {
..
..
}

I read online, that the condition to come out of while loop is the rightmost one [ !feof(stdin) ]. Then, what is the use of the above while statement as opposed to

while(!feof(stdin))
{
       printf("> ");
       fgets(str, 100, stdin);
       ...
       ...
}

Also, while statement takes an expression, so is 1,1,1 a valid expression in C?


The two loops given don't have the same meaning. By using the comma operator in that way, the author was able to specify code that should be executed every iteration, even if the loop itself is never entered. It's more like a do ... while () loop, or something like the following:

 printf("> ");
 fgets(str, 100, stdin);
 while(!feof(stdin)) {
    ..
    ..

    printf("> ");
    fgets(str, 100, stdin);
 }

The comma operator is best thought of as, well, an operator. Just like + is an operator, so that 2 + 3 is an expression (which happens to result in a value of 5), so too , is an operator, and thus 0, 1 is a valid expression (which happens to result in a value of 1, since that was the last operand).