Program to compare two string by strcmp.

#include<stdio.h>
#include<string.h>
void main()
{
    char a[20],b[20],s;
    printf(“Enter the first string”);
    gets(a);
    printf(“Enter the second string”);
    gets(b);
    s=strcmp(a,b);
    if(s==0)
      printf(“string matched”);
    else
       printf(“string not matched”);
     getch();
}

3 thoughts on “Program to compare two string by strcmp.

Leave a Reply

Your email address will not be published.