Given two strings, check whether both of the strings are equal or else print the difference of first non-ascii characters of both strings.
#include <stdio.h> #include<string.h> #include<stdlib.h> int compare(char *s,char *v) { printf("%s ",s); printf("and %s ",v); while(*s && (*s==*v)) { s++; v++; } return (*s-*v); } int main(void) { char *s,*v; s=(char*)malloc(sizeof(s)); v=(char*)malloc(sizeof(v)); scanf("%s",s); scanf("%s",v); if(compare(s,v)==0) printf("are Equal"); else printf("are not Equal"); return 0; }