#include<stdio.h>
#include<conio.h>
#include<string.h>
main()
{
char str1[30],str2[30];
clrscr();
printf("\nEnter 1st String");
gets(str1);
printf("\nEnter 2nd String");
gets(str2);
if(compare(*str1,*str2)==1)
{
printf("\nStrings are not same");
}else
{
printf("\nStrings are same");
}
getch();
}
int compare(char *str1,char *str2)
{
while(*str1!='\0' || *str2!='\0')
{
if(*str1==*str2)
{
str1++;str2++;
}else{return(1);}
}
return(0);
}
Comments
Post a Comment