Write a program to compare two strings in C Language - Program to compare two strings in C

Write a program to compare two strings in C Language

#include <stdio.h>

#include <string.h>

int main()

{

    char string1[100], string2[100];

    printf("\nEnter the first string = ");

    gets(string1);

    printf("\nEnter the second string = ");

    gets(string2);

    if (strcmp(string1,string2) == 0)

    printf("\nEntered strings are equal.\n");

    else

    printf("\nEntered strings are not equal.\n");

    return 0;

}


इस कोड को हमने CODEBLOCK पर बना कर run किया है

OUTPUT

Comments