check if string is the same c

To check if two strings are the same in C, you can use the strcmp() function from the <string.h> library. The strcmp() function compares two strings and returns 0 if they are the same.

Here's an example:

#include <stdio.h>
#include <string.h>

int main() {
    char str1[] = "Hello";
    char str2[] = "Hello";

    if (strcmp(str1, str2) == 0) {
        printf("The strings are the same.\n");
    } else {
        printf("The strings are different.\n");
    }

    return 0;
}

In this example, the strcmp() function is used to compare str1 and str2. If the return value of strcmp() is 0, it means the strings are the same, and the corresponding message is printed. Otherwise, if the return value is not 0, it means the strings are different, and a different message is printed.

You can replace the values of str1 and str2 with the strings you want to compare.