Home>Article>Backend Development> What are the symbols for relational operations in C language?
c language relational operation symbols include ", >=, ==, !=". Relational operators are all binary operators, and their function is to determine the relationship between the two expressions; the priority of relational operators is lower than that of arithmetic operators and higher than that of assignment operators; their operation results are only 0 or 1. The result is 1 when the condition is true, and 0 when the condition is not true.
##c language relational operation symbols include , >=, ==, !=.
The function of the relational operator is to determine the relationship between the two expressions. Note that this is to determine the size relationship, not other relationships. # 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. Among the six relational operators, , >= have the same precedence, which is higher than == and !=, and == and != have the same precedence. The operation result of relational operators is only 0 or 1. When the condition is true, the result is 1, and when the condition is not true, the result is 0#includeint main(){ char c='k'; int i=1, j=2, k=3; float x=3e+5, y=0.85; int result_1 = 'a'+5 =k+1 ); printf( "%d, %d\n", 1 Running result:
1, 0 1, 1 0, 0For expressions containing multiple relational operators, such as k==j= =i 5, according to the left associativity of the operator, first calculate k==j, this expression is not established, and its value is 0, and then calculate 0==i 5, it is not established, so the expression value is 0.It should be reminded that == means equal, and = means assignment. You should pay attention to the distinction and avoid confusion. Recommended tutorial: "
C Language"
The above is the detailed content of What are the symbols for relational operations in C language?. For more information, please follow other related articles on the PHP Chinese website!