Possible Duplicate:
function parameter evaluation order
Assuming that I have a function with 4 arguments. Which parameter is considered first for execution and why.
I was trying to understand the , operator's significance used for the function prototype. As is the rule is it the last variable considered first?
If we have a function with the following prototype:
int function(int x, int y, int z);
And we call it like so:
function( something_a(), something_b(), something_c() );
We have no ability to presume the order of execution of something_a, something_b and something_c.
On the other hand, we can use the comma operator as follows:
int main() {
int x;
something_a(), something_b();
something_c();
}
In this case, we know that something_a will be called, then something_b, and finally something_c.
In summary, the comma found in a function call, is not the comma operator.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With