C language check whether two strings are equal

www.la‮oc.iruttu‬m
C language check whether two strings are equal

How to check whether two strings are equal

/*
Example:Use the function strcmp() to compare the two strings in C language
*/

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

int main(int argc, char const *argv[]) {
    char string1[] = {"hello lautturi"};
    char string2[] = {"hello lautturi!"};

    if (strcmp(string1, string2) == 0)
        printf("same\n");
    else
        printf(" not same\n" );
    return 0;
}
Created Time:2017-08-28 12:04:41  Author:lautturi