#include <stdio.h>
#include <windows.h>
#include <assert.h>
int my_strlen(const char *arr)
{
int count = 0;//计数
while (*arr++){
count++;
}
return count;
}
int main()
{
char arr[] = "hello world";
int num = my_strlen(arr);
printf("%d\n", num);
system("pause");
return 0;
}
模拟实现strlen(C语言实现)
最新推荐文章于 2024-12-26 18:02:28 发布