【发布时间】:2015-06-07 01:01:14
【问题描述】:
我正在尝试编写一个程序,该程序允许用户将整数值插入到数组中,直到他们输入要停止的特定键,例如 ENTER 或 X。
int array_numb[100];
char quit = 'x';
printf("Enter as many values into the array as you want, pressing x will end the loop\n");
while(1==1){
int i = 0;
scanf("%i",&array_numb[i]);
i++;
array_numb[i] = quit;
}
我知道这是错误的,但这是我的思考过程。有任何想法吗?感谢您的帮助
【问题讨论】:
标签: c arrays input while-loop scanf