Code:
#include <stdio.h>
int f(int c, int b, int a);
int main() {
int a=2, b=3, c=5;
printf("a=%d b=%d c=%d\n",a,b,c);
a = f(b, a, b+c);
printf("a=%d b=%d c=%d\n",a,b,c);
system("pause");
return 0;
}
int f(int c, int b, int a) {
int sum;
sum = a + b + c;
if(sum > a*c)
return a*c;
if(sum <= b*c)
return b*c;
return a*b;
}
Output:
a=2 b=3 c=5
a=16 b=3 c=5
I am starting to understand pointer but still confused.
Does sum equal to 13? If so, what is a,b,c and where to obtain the variables for a,b,c: a+b+c=13?
Code:
if(sum > a*c) return a*c;
if(sum <= b*c)
return b*c;
return a*b;
Why are there two returns assuming one of the "if" statement is true?
Lastly, what does implies?
Thank You.