what is the ans of this??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

what is the ans of this???

int a=1; int b=2; c=++b; cout<<c; cout<<c+b;

19th Sep 2017, 3:03 PM
yogesh mishra
yogesh mishra - avatar
2 Answers
+ 10
++b increments b by 1 making it 3. And then, b is assigned to c, so c as well becomes 3 and hence the output is 3 and 6. Note : You didn't declare the data type to the variable c, so there are exceptions.
19th Sep 2017, 3:06 PM
Dev
Dev - avatar
+ 5
Output is 36
19th Sep 2017, 3:16 PM
Dragon Slayer Xavier
Dragon Slayer Xavier - avatar