安全问答

安全问答是一个知识全球问答,包含丰富的问答知识

首页 常规 游戏 娱乐 科技 程序员

C语言字符串长度计算 - 不使用strlen函数

  • 日期: 2025-06-03
  • 标签: 常规

#include\u003cstdio.h\u003e

int getlen(char str[]) {\n int count = 0;\n for (int i = 0; str[i] != '\u0000'; i++) {\n count++;\n }\n return count;\n}\n int main() {\n char str[100];\n gets(str);\n int len = getlen(str);\n printf("len=%d", len);\n return 0;\n}


原文地址: https://www.cveoy.top/t/topic/pxHG 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录

  • 上一篇: 文化与文明:概念辨析及区别
  • 下一篇: 2023年上半年会务岗位总结:高效组织,创新活动,助力公司发展

© 2019 • 2025 - 安全问答 站长邮箱:wxgpt@qq.com    ICP备案/许可证号:豫ICP备2024104334号-2