摘要:
如果要写一个从字符串中查找一个字符的函数,相信你不难想到如下代码: 1 char* __cdecl strchr_1( 2 char const* _Str, 3 int _Val 4 ) { 5 6 while (*_Str && *_Str != _Val) 7 _Str++; 8 9 if ( 阅读全文
posted @ 2021-04-04 17:33
plle
阅读(414)
评论(0)
推荐(0)
摘要:
如果要你写一个计算字符串长度的函数 strlen,应该怎么写?相信你很容易写出如下实现: 1 int strlen_1(const char* str) { 2 int cnt = 0; 3 4 if (NULL == str) { 5 return 0; 6 } 7 8 while (*str ! 阅读全文
posted @ 2021-04-04 17:18
plle
阅读(546)
评论(0)
推荐(3)

浙公网安备 33010602011771号