int foo(int a){ return (++a * a++); }
int main()
{
cout << foo(5);
}
how does "return(++a * a++)" differ from "return(a++ * ++a)"?
that is, I get the same output (36 for both), but doesn't the postfix operator have a higher precedence than the prefix operator...which is operated on first, the first term or the second?
Is the order of precedence as follows:
++a > a > a++ ?
incidentally, I got similar results using this:
return (a++ * a) = return (a * a++) = 25 ?
int main()
{
cout << foo(5);
}
how does "return(++a * a++)" differ from "return(a++ * ++a)"?
that is, I get the same output (36 for both), but doesn't the postfix operator have a higher precedence than the prefix operator...which is operated on first, the first term or the second?
Is the order of precedence as follows:
++a > a > a++ ?
incidentally, I got similar results using this:
return (a++ * a) = return (a * a++) = 25 ?