2009年5月26日火曜日

C:文字数のカウント

int ln;
char *str ="test";

for(ln=0;*str != '\0' ; str++,ln++);

printf("%sの文字数は\n",str);
printf("%d文字\n",ln);

0 件のコメント: