Program to Illustrate “strcmp” function

#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char s1[20],s2[20];
int x;
clrscr();
printf("\nEnter S1");
scanf("\n%s",&s1);
printf("\nEnter S2");
scanf("\n%s",&
s2);
x=strcmp(s1,s2);
if (x==0)
printf("\nEqual");
else
printf("\nNot Equal");
getch();
}

Leave a Reply