Can anyone tell me what are the differences between x=3 x==3 in C programming? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can anyone tell me what are the differences between x=3 x==3 in C programming?

I'm a beginner

24th Sep 2019, 11:34 AM
Md Mehedi Islam Khan Ifti
Md Mehedi Islam Khan Ifti - avatar
2 Answers
+ 3
x=3 is an assignment. x==3 is an boolean logic. x=3 is like, "No matter what x is, I want x is 3 now.", which x would be 3 after this line. x==3 is like, "Is x 3 now?", which the answer would be "yes -> true" or "no -> false" and wouldn't change what x is.
24th Sep 2019, 11:52 AM
你知道規則,我也是
你知道規則,我也是 - avatar
+ 3
x == 3 is a comparision. Is x equal to 3? x =3 is a allocation. x becomes 3.
24th Sep 2019, 11:56 AM
Danny Eeraerts
Danny Eeraerts - avatar