Header Ads Widget

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();
}

Post a Comment

3 Comments