0
can someone explain why output is 5. and not 6 ?
#include <iostream> #include <string> using namespace std; int main() { int a=5; int b=1<--a;// 1 int c=1+--a;// 5 int d=1+b*c; // Output 5 cout<<d; return 0; }
2 Respuestas
+ 7
int c = 1 + --a;
The value of `a` before this line was 4. On reaching this line it become 3, so 1 + 3 = 4. That is why value of `c` is 4 not 5.
This itself further explains your question.
0
Thanks 👍