Order of function parameter execution
suggest changeThe evaluations of function arguments are unsequenced. Either argument may be evaluated first, and a program must not rely on an order. The call below also modifies a twice with no intervening sequence point, which is undefined behavior, not merely an unspecified order. Do not treat a particular printed result as portable.
#include <stdio.h>
void function(int a, int b)
{
printf("%d %d\n", a, b);
}
int main(void)
{
int a = 1;
function(a++, ++a);
return 0;
}
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents