#include <stdio.h> #include <stdlib.h>
int strcmp(char *source, char *dest) { while(*source == *dest && *source != '\0' && *dest != '\0') { source++; dest++; } if (*source =='\0' && *dest == '\0') return 0; else return -1;
} int main() { char *str1 = "abcde"; char *str2 = "abcde"; printf("ret = %d", mystrcmp(str1, str2));
return 0; }
|