+ 1

What is the output?

int a=3 int b=2 b=a++ cout<<++b

6th Oct 2017, 12:32 PM
SHRIYANSH DUBEY
SHRIYANSH DUBEY - avatar
6 Réponses
+ 8
Semicolons are missing. If this error is fixed, answer should be 4. b = a++; // a = 4, b = 3 (post-increment issue) cout << ++b; // prints 4 You can get clearer idea by searching for "pre-increment and post-increment" on Google or SL.
6th Oct 2017, 1:51 PM
Shamima Yasmin
Shamima Yasmin - avatar
0
5
6th Oct 2017, 12:33 PM
shobhit
shobhit - avatar
0
bro that's wrong
6th Oct 2017, 12:41 PM
SHRIYANSH DUBEY
SHRIYANSH DUBEY - avatar
0
ok so whats the correct ans.
6th Oct 2017, 12:48 PM
shobhit
shobhit - avatar
0
@shobhit I am asking ,how could I know
6th Oct 2017, 12:56 PM
SHRIYANSH DUBEY
SHRIYANSH DUBEY - avatar
0
5
8th Oct 2017, 3:28 PM
Ramanamurthy Bure
Ramanamurthy Bure - avatar