问题:
1.主函数定义p时没有加count
2.子函数忘记加assert
int My_strlen(const char* str)
{
int count = 0;
assert(*str != NULL);
while (*str++)
{
count++;
}
return count;
}
int main()
{
const char* p = "shuzuchangdu";
printf("%d\n", My_strlen(p));
}
问题:
1.主函数定义p时没有加count
2.子函数忘记加assert
int My_strlen(const char* str)
{
int count = 0;
assert(*str != NULL);
while (*str++)
{
count++;
}
return count;
}
int main()
{
const char* p = "shuzuchangdu";
printf("%d\n", My_strlen(p));
}