定义被一些字符串,求长度并运算、输出。
#include <stdio.h>
#include <string.h>
int main(void) {
char s1[100];
char s2[20] = "hello!";
scanf("%s",&s1);
printf("%d\n",strlen(s1));
printf("%s\n",s2);
printf("%d\n",strlen(s2));
return 0;
}
输入:
app
输出:
3
hello!
6