C Programming
#include
#include
int compstr(char *str1,char *str2)
{
int y;
while(*str1!='\0'||*str2!='\0')
{
// putch(*str1);
if(*str1!=*str2)
{
y=-1;
break;
}
else
y=0;
*str1++;
*str2++;
}
return y;
}
void main()
{
clrscr();
char *str1,*str2;
int x;
printf("Enter first string:");
gets(str1);
printf("Enter second string:");
gets(str2);
x=compstr(str1,str2);
if(x==0)
printf("The two string are equal:");
else
printf("The two string are not equal:");
getch();
}
0 comments:
Post a Comment