+ 2
What is the difference between '=' and '==' ?
3 Answers
+ 3
=
assign right side value to left side variable
==
check if both sides are equal
(1==2) has a value 0
if (1==2) cout <<"equal";
equal will not be printed but,
if (1==1)cout <<"equal";
equal will be printed...
0
= means assignment,== means equals to
0
in c++ the "==" sign makes the program checks whether it is equal or not and by using "=" we are stating that it is equal