Trying to learn C++ myself from the book and im on chapter 9 about functions.
The question is...
Write and test a function that takes the addresses of three double variable as arguments and that moves the value of the smallest carrying into the first variable, the middle value to the second variable, and the largest value into the third variable.
int main()
{
int a,b,c;
a=20;
b=23;
c=10;
printf("a = %d, b = %d, c = %d\n", a , b, c);
swap(&a,&b,&c);
printf("a = %d, b = %d, c = %d\n", a , b, c);
return 0;
}
Let's just break down the first "?:" since they're all the same.
1 2 3 4 5 6
max = (*a)>(*b) // max is being assigned a true/false value based on the RVal boolean
? *a // pick this if true
: *b; // pick this if false
// btw I do the parentheses because I'm not giving the compiler
// a chance to decide order of operations when it comes to pointers