C PROGRAM CODE
#include<stdio.h>
main()
{
char s1[25],s2[25],*t1,*t2;
int cmp=0;
printf("\n ENTER FIRST STRING:\n ");
scanf("%s",&s1);
printf("\n ENTER SECOND STRING:\n ");
scanf("%s",&s2);
t1=s1;
//copying base address of string
t2=s2;
while(*t1!='\0'&&*t2!='\0')
{
if(*t1!=*t2)
{
cmp++;
}
t1++;
t2++;
}
if(cmp==0)
{
printf("\n BOTH ARE EQUAL.\n ");
}
else
{
printf("\n BOTH ARE NOT EQUAL.\n ");
}
}
No comments:
Post a Comment