What is the difference between = and == ? And when they are used ??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the difference between = and == ? And when they are used ???

for both c and c++

24th Jan 2017, 1:12 PM
Pritam Vivek
Pritam Vivek - avatar
2 Answers
+ 2
"=" for 'equals' and "==" for 'is equal to'. If you read your condition with those phrases then you'll better understand the condition you're trying to prove. The main difference is that the "=" is an assignment operator and the "==" sign tests a condition. Example: i = num1 + 1. (Assigns num1 + 1 to i) Example: num1 == num2. (Checks if num1 is equal to num2)
24th Jan 2017, 1:22 PM
Ghauth Christians
Ghauth Christians - avatar
+ 2
= assigns a value to a variable == equality, if this is the same as that
24th Jan 2017, 1:46 PM
Uran Kajtazaj
Uran Kajtazaj - avatar