0
What is difference b/w =&==
in c++ program
3 Answers
+ 2
= is the assignment operator.
b = 1 will set the variable b equal to the value 1.
== is the equality operator.
it returns true if the left side is equal to the right side, and returns false if they are not equal.
With only rare exceptions, you should not be using the assignment operator inside an if clause, but that is an extremely common beginner mistake.
+ 1
a = b is to make a equal to b.
a == b is to ask a is equal to b.
0
= asignment operator eg: a=5 Now a has the value of 5
== comparision operator eg: a==5 returns true because both are equal