为何这段代码会不断要你输入?即使按了回车后也不会停止?
为何这段代码会不断要你输入?即使按了回车后也不会停止?程序代码:
#include<stdio.h> #define a 256 int main(void){ char ch[a]; int index; index=0; scanf("%c",&ch[index]); while(ch[index]!='\n'){ scanf("%c",&ch[index]); index++; } return 0;
#include<stdio.h> #define a 256 int main(void){ char ch[a]; int index; index=0; scanf("%c",&ch[index]); while(ch[index]!='\n'){ scanf("%c",&ch[index]); index++; } return 0;
#include<stdio.h> #define a 256 int main(void){ char ch[a]; int index; index=0; scanf("%c",&ch[index]); while(ch[index]!='\n'){ scanf("%c",&ch[index]); } return 0; }
#include<stdio.h> #define a 256 int main(void){ char ch[a]; int index; index=0; scanf("%c",&ch[index]); while(ch[index]!='\n'){ scanf("%c",&ch[index]); index++; } return 0;