因为包含<stdio.h>不能成功编译,所以自己写了个比较字符串相等的函数(也算这些日子以来自己唯一写的C函数吧)
int strcmp(char * str1, char * str2) {
int len1 = 0, len2 = 0;
char *a, *b;
a = str1;
b = str2;
while (*a++)
len1++;
while (*b++)
len2++;
if (len1 != len2)
return -1;
while (*str1++ != 0 && *str2++ != 0) {
if (*str1 != *str2) {
return -1;
}
}
return 0;
}