What is difference b/w =&== | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is difference b/w =&==

in c++ program

7th Nov 2016, 2:49 PM
umesh kumar
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.
7th Nov 2016, 3:08 PM
Shady Alset
Shady Alset - avatar
+ 1
a = b is to make a equal to b. a == b is to ask a is equal to b.
7th Nov 2016, 3:45 PM
kiwiyou
kiwiyou - avatar
0
= asignment operator eg: a=5 Now a has the value of 5 == comparision operator eg: a==5 returns true because both are equal
7th Nov 2016, 3:09 PM
рооройрпЛроЬрпНроХрпБрооро╛ро░рпН рокро┤ройро┐роЪрпНроЪро╛рооро┐
рооройрпЛроЬрпНроХрпБрооро╛ро░рпН рокро┤ройро┐роЪрпНроЪро╛рооро┐ - avatar