Home  >  Article  >  Backend Development  >  What is the difference between = and == in C language?

What is the difference between = and == in C language?

尚
Original
2020-03-02 13:19:1624028browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn