/* mystrcomp.c: comparing the strings */ #include int mystrcomp(char *s1, char *s2); int main(void) { char s[] = "Hello guys!"; char ss[] = "It's a good day, isn't it?"; int result; result = mystrcomp(s, ss); if(result == 0) printf("those are the same\n"); else printf("those are different\n"); return(0); } int mystrcomp(char *s1, char *s2) { char *p1 = &s1[0], *p2 = &s2[0]; while(1) { if(*p1 != *p2) return *p1 - *p2; if(*p1 == '\0' || *p2 == '\0') return 0; p1++; p2++; } }