In C language, the difference between the "==" and "===" comparison operators is that "==" only compares values, while "===" compares both values and types. Therefore, values of different types may be equal when using "==", while using "===" will return true only if the value and type are equal.
The difference between "==" and "===" in C language
Question: What is the difference between the "==" and "===" operators in C language?
Answer: "==" and "===" are comparison operators in C language, but they have different behaviors:
"= ="operator
"===" operator
Example:
<code class="c">int a = 1; double b = 1.0; if (a == b) { // 值相等,无论类型不同 printf("值相等\n"); } if (a === b) { // 值和类型都相等 printf("值和类型都相等\n"); }</code>
Usage difference:
The above is the detailed content of The difference between equal and double equal in C language. For more information, please follow other related articles on the PHP Chinese website!