Home > Article > Backend Development > What is the difference between = and == in C language?
The difference between == and = in C language is only in one aspect of meaning, as follows:
"==" is a relational operator, and " =" is the assignment operator.
Relational operators are all binary operators, and their associativity is left associative. Relational operators have lower precedence than arithmetic operators and higher than assignment operators.
"=" is not equal to a symbol, but an assignment operator, such as x=3. In addition, you can also assign the same value to multiple variables in one statement, that is, multiple assignment.
Compared with the assignment operator, which has only one equal sign, the equal operator in the relational operator is represented by two equal signs "==".
Recommended: "c Language Tutorial"
The above is the detailed content of What is the difference between = and == in C language?. For more information, please follow other related articles on the PHP Chinese website!