int i = 0; printf("%i %i", i++, ++i); // prints "0 2"
[EDIT] Turns out this is a bad example, as "the order in which function arguments are evaluated is undefined" (cf. below) Correct is :
int i = 0; printf("%i", i++); // prints 0 printf("%i", ++i); // prints 2
You can use a comma in other expressions to introduce a sequence point: http://c-faq.com/~scs/cgi-bin/faqcat.cgi?sec=expr#seqpoints
You surely are right. I wanted to give a quick example, turns out it was a bad one. Next time I'll write :
Given that you were making a point on an article about the complexity of C, I'd say it was an unintentionally excellent example.
i = i++;
Is there any rule saying that args to a function have to be evaluated in a particular order - ie is ',' a function point?
[EDIT] Turns out this is a bad example, as "the order in which function arguments are evaluated is undefined" (cf. below) Correct is :