// 实现一个函数,求字符串的长度,不允许创建第三方变量。
#include <stdio.h>
#include <assert.h>
int my_strlen_no(char const *p)
{
assert(p != NULL);
if (*p == NULL)
return 0;
else
return (1 + my_strlen_no(p + 1));
}
int main()
{
char *p = "zhaoyaqian";
printf("长度是:%d\n", my_strlen_no(p));
return 0;
}