C program to check if two strings are equal

You can use the library function strcmp for comparison. 
strcmp is a library function for comparing strings in C language. The form is
int strcmp(char *a, char *b);
this function will compare each character of a and b according to the ascii code value, and return 0 if the two are exactly the same; if the ascii code value of a appears larger first Otherwise, it will return 1; otherwise, it will return -1.

Therefore, to judge that the strings are equal, you can use
if(strcmp(string1, string2) == 0)
If the return is 0, they are equal, otherwise they are not equal.

Guess you like

Origin blog.csdn.net/yilovexing/article/details/53924983