本文转载自:http://www.cppblog.com/mmdengwo/archive/2011/04/14/144253.aspx
#include <stdio.h>
#include <stdlib.h>
int strcmp(char *source, char *dest)
{
while(*source == *dest && *source != ' ' && *dest != ' ')
{
source++;
dest++;
}
if (*source ==' ' && *dest == ' ')
return 0;
else
return -1;
}
int main()
{
char *str1 = "abcde";
char *str2 = "abcde";
printf("ret = %d", mystrcmp(str1, str2));
return 0;
}