+ 3

why cout << i==‘1’ causes an error?

https://code.sololearn.com/c6wLOPzA10dY/?ref=app In this code: Int i=5; cout << i==‘1’ Causes an error However, cout << (i==‘1’) Prints 0?

26th Sep 2018, 5:37 AM
wave rider
3 Answers
+ 9
The overloaded insertion << operator has higher precendence over == operator.
26th Sep 2018, 5:51 AM
Hoàng Nguyễn Văn
Hoàng Nguyễn Văn - avatar
+ 5
i see, now it makes sense, it would be nice if << operator was explained in advanced c++ tutorial
26th Sep 2018, 7:53 AM
wave rider
0
yes
1st Apr 2019, 8:35 PM
Leon🐕🐶
Leon🐕🐶 - avatar