Is there a performance difference between the two following functions, or is it handled by the compiler the same?
double f1(double a, double b) {
return a + b;
}
double f2(double a, double b) {
double sum = a + b;
return sum;
}
Thanks.
>Solution :
Is there a performance difference between the two following functions
One function contains two statements and the other contains one statement.
or is it handled by the compiler the same?
They can be. Both functions have identical observable behaviour, so they may produce an identical program.