题解 | #获取字符串长度#
获取字符串长度
https://www.nowcoder.com/practice/9a2d212d23f5436c80607d5e68c6d12a
#include <stdio.h>
int main() {
char* p;
char ch[99];
int x=0;
p=ch;
gets(ch);
while(*p++!='\0')
{
x++;
}
printf("%d", x);
return 0;
}
获取字符串长度
https://www.nowcoder.com/practice/9a2d212d23f5436c80607d5e68c6d12a
#include <stdio.h>
int main() {
char* p;
char ch[99];
int x=0;
p=ch;
gets(ch);
while(*p++!='\0')
{
x++;
}
printf("%d", x);
return 0;
}
相关推荐