The behavior of the program is unspecified since we don't know the order of evaluation of the function arguments, from the <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3485.pdf">draft C++ standard</a> `1.9` *Program execution paragraph 3*:
>Certain other aspects and operations of the abstract machine are described in this International Standard **as unspecified (for example, order of evaluation of arguments to a function).** Where possible, this International Standard defines a set of allowable behaviors. [...]
and all side effects from the arguments are sequenced before the function is entered, from section `5.2.2` *Function call paragraph 8*:
>[ Note: The evaluations of the postfix expression and of the argument expressions are all unsequenced relative to one another. **All side effects of argument expression evaluations are sequenced before the function is entered** (see 1.9). —end note ]
As for `C` both points are covered in the <a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf">C99 draft standard</a> in section `6.5.2.2` *Function calls paragraph 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.
So in both `C` and `C++` you can end up with either `f(0,0)` or `f(42,0)`.