C言語なら俺に聞け(入門篇) Part 45
■ このスレッドは過去ログ倉庫に格納されています
0313デフォルトの名無しさん
2009/02/23(月) 21:13:36最後のprintf文の最初の出力文字を大文字にしたい。
#include <stdio.h>
#include <ctype.h>
main() {
char *fruits[]={"apple", "orange", "kiwi"};
int i;
printf("Suppose that we now have (0) %s, (1) %s, (2) %s.\n",
fruits[0],fruits[1],fruits[2]);
printf("Input 0, 1, or 2: ");
scanf("%d",&i);
*fruits[i]=toupper(*fruits[i]); /*ここがエラー*/
printf("\n%s is your favorite fruit!\n",fruits[i]);
}
■ このスレッドは過去ログ倉庫に格納されています