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
Do you know the use of vtable?
What do you mean by const correctness?
Distinguish between new and malloc and delete and free().
Who made c++?
What are the types of array in c++?
What is setf in c++?
Write about an iterator class?
what are the decision making statements in C++? Explain if statement with an example?
Difference between delete and free.
How const int *ourpointer differs from int const *ourpointer?
What are stacks? Give an example where they are useful.
How many namespaces are there in c++?
Explain function overloading and operator overloading.
What are pointer-to-members? Explain.
How to declare a pointer to an array of integers?