0
Can anyone tell me what are the differences between x=3 x==3 in C programming?
I'm a beginner
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.
+ 3
x == 3 is a comparision. Is x equal to 3?
x =3 is a allocation. x becomes 3.