加入<string.h>
使用函式strlen(s)
#include
#include
int main(void)
{
char s[10];
scanf("%s",s);
printf("存放字串總元素個數:%d個\n",sizeof(s)/sizeof(char));
printf("共使用%d個元素!\n",strlen(s));
return 0;
}
文章標籤
全站熱搜
加入<string.h>
使用函式strlen(s)
#include
#include
int main(void)
{
char s[10];
scanf("%s",s);
printf("存放字串總元素個數:%d個\n",sizeof(s)/sizeof(char));
printf("共使用%d個元素!\n",strlen(s));
return 0;
}

東勢厝yang 雜七雜八亂亂記
