+ 1
Someone explain this to me properly
a =2 b=3 b=a++ cout<<++b;
5 Answers
+ 3
Thanks I just got it.
b=3
a=2
b=a++
/*
what it did is
as a++ is postfix
b=a // b = 2
a=a+1 //a=3
*/
and when cout<<++b;
/*
it incremented b and then printed it as prefix does
i.e: it printed +1 + b // print = 1+b //where b is 2 as above code.
therefore, print(output) = 3 //3 is output
*/
I have explained it to others and thanks man
+ 1
a =2
b=3
b=a++ // b is 2 and a is 3
cout<<++b; // b is 3
+ 1
Just explain me breifly what happened when I did '++b'
+ 1
it add 1 to b
a++ mean assign first add 1 later
++b mean add 1 first
+ 1
you are welcome