#include
#include
#include
char *input();
int cmp(char * ,char *);
int main()
{
char *a,*b;
int i;
printf(“Enter 1st string:”);
a=input();
printf(“Enter 2nd string:”);
b=input();
i=cmp(a,b);
printf(“Comparision is=%d\n”,i);
}
char *input()
{
char *s1,ch;
int i=0;
s1=(char *)malloc(sizeof(char));
while(1)
{
scanf(“%c”,&ch);
s1=realloc(s1,(i+2)*sizeof(char));
if(ch==10)
break;
s1[i]=ch;
i++;
}
return s1;
}
int cmp(char *a,char *b)
{
int i,j,flag=0;
for(i=0;i<=5;i++)
{
if(*(a+i)!=*(b+i))
{
j=*(a+i)-*(b+i);
return j;
}
}
}