C语言字符串有效长度计算方法
#include <stdio.h>
int count(char a[]) { int i = 0; while (a[i] != '\0') { i++; } return i; }
main() { char a[50]; printf('请输入一个字符串:'); gets(a); int t = count(a); printf('有效长度为:%d\n', t); }
原文地址: https://www.cveoy.top/t/topic/n7lU 著作权归作者所有。请勿转载和采集!