Check if two characters are equal in the C language.

In C language, the “==” operator can be used to determine if two characters are equal. For example:

#include <stdio.h>

int main() {
    char a = 'a';
    char b = 'b';

    if (a == b) {
        printf("两个字符相等\n");
    } else {
        printf("两个字符不相等\n");
    }

    return 0;
}

The output is “the two characters are not equal”.

Leave a Reply 0

Your email address will not be published. Required fields are marked *


广告
Closing in 10 seconds
bannerAds