<C Primer Plus>7 The Comma Operator
1 #include <stdio.h> 2 #include <math.h> 3 int main(void){ 4 const int FIRST_OZ = 46; 5 const int NEXT_OZ = 20; 6 int ounces, cost; 7 8 printf(" ounces cost\n"); 9 for (ounces = 1, cost = FIRST_OZ; ounces < 16;ounces++,cost += NEXT_OZ){/// initialize and proess the value.. 10 printf("%5d $%4.2f\n", ounces, cost / 100.0); 11 } 12 13 return 0; 14 }
x = (y = 3, (z = ++y + 2) + 5);
the result is x = 11;
REMEBER:
The comma being a sequence point guarantees that the side effects of the left subexpression occur before the right subexpression is evaluated.