0==0 means what? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

0==0 means what?

if I write cout<<0==0; then it gives the output as 0. why and how? please explain.

7th Feb 2017, 4:50 PM
Mustafa Rokadiya
Mustafa Rokadiya - avatar
2 Answers
0
you need brackets. What you are doing now is comparing (cout<<0) with 0
7th Feb 2017, 4:57 PM
Zilvinas Steckevicius
Zilvinas Steckevicius - avatar
0
This is because == has a lower operator precedence than <<. The compiler sees this as: cout <<0; 0==0; So 0 is output and then 0==0 is evaluated to true, but nothing is done with it.
7th Feb 2017, 7:15 PM
ChaoticDawg
ChaoticDawg - avatar