+ 1
Explain why the output is 12 instead of 9
#include <iostream> using namespace std; #define sq(x) (x)*(x) int main() { int a=3; cout<<sq(a++); return 0; }
1 Odpowiedź
0
You increment a by one with the '++' term after the first operation, so it is 3 times 4 = 12. Delete ++ to calculate the square of 3.