What is the difference between = and == in C?
Answer Posted / chandan
= Assignment Operator
== Comparision Operator
One Intresting Difference between these two is in the =
operator the left side can not be a const, while in == we
can place Const in either side.
eg. x = 5 //correct
5 = x // Incorrect
but X == 5 // CORRECT
5 == X // Correct and Preffered to use left value
as constant to avoid the unwanted bug.
| Is This Answer Correct ? | 46 Yes | 7 No |
Post New Answer View All Answers
Can a program run without main in c++?
Do you know what is overriding?
How the endl and setw manipulator works?
Is java easier than c++?
What do you mean by stack unwinding in c++?
How do I exit turbo c++?
What is the precedence when there is a global variable and a local variable in the program with the same name?
How do I download c++?
What is the size of integer variable?
Where can I run c++ program?
Explain rtti.
What does int * mean in c++?
Define namespace in c++?
Difference between class and structure.
Is there any function that can skip certain number of characters present in the input stream?