大家好,正所谓正义或许会迟到,但绝对不会忘记砸到你的头顶,期待已久的my_strlen函数
它来了!!!
主菜:
废话不多说上才艺!
#include#include size_t my_strlen(const char* str) { assert(str); int count = 0; while (*str != ' ') { count++; str++; } return count; } int main() { char arr[13] = "woaizhongguo";//创建字符串 int len = my_strlen(arr);//创建自定义函数来计算字符串长度,并用整型变量len存储 printf("%d", len);//打印字符串长度 return 0; }
好了以上就是本期的主要内容,谢谢大家的观看。



