Check if characters are equal in the C language.
In C language, the == operator can be used to check if two characters are equal. Here is an example code:
#include <stdio.h>
int main() {
char c1 = 'a';
char c2 = 'b';
if (c1 == c2) {
printf("c1和c2相等\n");
} else {
printf("c1和c2不相等\n");
}
return 0;
}
This code will output “c1 and c2 are not equal” because the value of c1 is ‘a’ and the value of c2 is ‘b’, which are not equal.