Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int myStrcmp(char s1[], char s2[]){
- int len1 = 0, len2 = 0;
- while (s1[len1]!='\0') len1++;
- while (s2[len2]!='\0') len2++;
- if (len1<len2) return -1;
- if (len1>len2) return 1;
- for(int i=0; i<len1; i++){
- if (s1[i]>s2[i]) return 1;
- if (s1[i]<s2[i]) return -1;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment