如果要你写一个计算字符串长度的函数 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 != '