+ 4
What is the difference between "=" and "==" operator??
In c++ only Can anyone explaine. And when to use each one
7 Answers
+ 4
= is an assignment operator
== compares values
+ 8
= is used for assignment between variables and value.
Example:
int x = 5;
== is used for comparison and conditions
Example:
if (x + y == 5)
And please Kindly use the search bar first before asking. Thanks!
https://www.sololearn.com/Discuss/1652195/and-in-c
https://www.sololearn.com/Discuss/1084542/vs
https://www.sololearn.com/Discuss/918660/if-statements-vs
https://www.sololearn.com/Discuss/1171728/difference-between-and
https://www.sololearn.com/Discuss/842952/the-difference-between-and
+ 3
TheGirlHasNoName this was a C++ question. There is no === in C++.
+ 3
TheGirlHasNoName that's OK. No problem.
+ 2
= is for assigning value to a variable
== is used to test equality between two expressions we can use it in loops in conditions for test .
=== it is used to test equality between two expression + to compare the types of both expressions
Example:
Boolean a = '1'===1;
The value of a is false because'1' is type string and 1 is type int
+ 1
Thank you Sonic i thought it was the same for java and c++
+ 1
= operator declares a value for ex a=10
While == operator is a relational operator as the name suggests it compares two value