题解 | #获取字符串长度#
获取字符串长度
https://www.nowcoder.com/practice/9a2d212d23f5436c80607d5e68c6d12a
#include <stdio.h>
#include <malloc.h>
int main() {
char *p=(char*)malloc(100);
scanf("%[^\n]",p);//读取除了换行符的字符放入缓冲区
int len=0;
while(*p++!='\0')len++;
printf("%d",len);
return 0;
}
#C#0基础学C 文章被收录于专栏
0基础学C,从算法开始