如果用for语句进行类型为%s的连续输入,程序最终没反应,这是为什么?
代码和运行截图呢
供参考:
#include<stdio.h>
#define N 128
#define M 256
int main()
{
char str[N][M];
int i=0,j;
while(scanf("%s",str[i])!=EOF) i++;// ctrl+z 结束输入
for(j=0;j<i;j++)
printf("%s\n",str[j]);
return 0;
}
用while循环进行多组输入while(scanf("%s",&arr)!=EOF)
不过应该要定义一个二维数组来接收