I cannot figure out the reason why I am getting this result. I am not the order in which the function calls it's arguments. I would assume that it would start at the first argument and go until the last. Here's the code...
#include <stdio.h>
int addmeup(int a, int b, int c){
printf("a:%d\n", a);
printf("b:%d\n", b);
printf("c:%d\n", c);
return a + 2 * b + 3 * c;
}
int main(){
int x = 1;
int y = addmeup(x++,x++,x++);
printf("x:%d\n", x);
printf("y:%d\n", y);
return 0;
}
I don't know why the result I am getting is...
a:3
b:2
c:1
x:4
y:10
For the function addmeup()
why wouldn't the a be 1 instead of 3? Then b would be 2 and c would be 3. But it is the opposite. Can't seem to wrap my head around this.