I don't understand what is passed to the function f() when I call it like this.main(){  void f(int,int);  int i=10;  f(i,i++);}void f(int i,int j){ printf(%d %d,i,j); }gives me 11 10 .Can somebody explain why its 11?
How are functions called when passing ++
c;functions
The behavior is undefined, as follows:  From the C99 standard:6.5 Expressions...2 Between the previous and next sequence point an object shall have its stored value modified at most once by the evaluation of an expression.72) Furthermore, the prior value  shall be read only to determine the value to be stored.73)72) A floating-point status flag is not an object and can be set more than once within an expression.73) This paragraph renders undefined statement expressions such as    i = ++i + 1;    a[i++] = i;while allowing    i = i + 1;    a[i] = i;We're violating the second sentence of that paragraph; we're not just reading the prior value to determine the new value to be stored.  Note that undefined doesn't necessarily mean illegal.  Undefined simply means that the compiler is free to handle the situation any way it sees fit; any result is considered correct.  You could very well wind up with the result you expected.  Or not.  The program could crash.  Or not.  Or anything else could happen.  In this case, you will get different results based on platform, compiler, optimization settings, surrounding code, etc.  The reason for that is as follows:6.5.2.2 Function calls...10 The order of evaluation of the function designator, the actual arguments, and  subexpressions within the actual arguments is unspecified, but there is a sequence point   before the actual call.It is unspecified whether i or i++ is evaluated first; furthermore, it is unspecified whether the side effect of ++ is applied immediately after i++ is evaluated, as follows:6.5.2.4 Postfix increment and decrement operators...2 The result of the postfix ++ operator is the value of the operand. After the result is   obtained, the value of the operand is incremented. (That is, the value 1 of the appropriate  type is added to it.) See the discussions of additive operators and compound assignment for information on constraints, types, and conversions and the effects of operations onpointers. The side effect of updating the stored value of the operand shall occur betweenthe previous and the next sequence point.Emphasis mine.EditChanged the wording a bit to make it clear that the behavior is undefined.  