#include <conio.h>
int compare_strings(char*, char*);
int main()
{
char str1[100], str2[100], result;
printf("Enter first string: ");
gets(str1);
printf("Enter second string: ");
gets(str2);
result = compare_strings(str1, str2);
if ( result == 0 )
printf("Strings are same.\n");
else
printf("Entered strings are not equal.\n");
getch();
}
int compare_strings(char *str1, char *str2)
{
while(*str1==*str2)
{
if ( *str1 == '\0' || *str2 == '\0' )
break;
str1++;
str2++;
}
if( *str1 == '\0' && *str2 == '\0' )
return 0;
else
return 1;
}