+ 1

code doubt??

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

8th Dec 2016, 5:44 AM
Udhay Shankar.D
Udhay Shankar.D - avatar
3 Answers
+ 25
it will print 4.
8th Dec 2016, 6:34 AM
Jobelle
Jobelle - avatar
+ 2
b = a++; // it's post increment here and currently a is 3. So b is assigned to 3 cout << ++b; // It's pre increment. So b will be incremented before its prints. 3 + 1 = 4. So b is changed to 4. Finally 4 is the answer. Hope you understand this concept
8th Dec 2016, 8:13 AM
Venkatesh(Venki)
Venkatesh(Venki) - avatar
0
i wnt explanation for this
8th Dec 2016, 7:02 AM
Udhay Shankar.D
Udhay Shankar.D - avatar