【发布时间】:2023-01-15 00:22:31
【问题描述】:
有问题的程序:#1:
int main(void) {
int size;
scanf("%d", &size);
int v[size];
for(int i = 0; i < size; ++i) {
scanf("%d", &v[i]);
printf("the %d-th element is : %d\n",i, v[i]);
}
return 0;
}
开/关:
5
6 7 8 9 10 11
the 0-th element is : 6
the 1-th element is : 7
the 2-th element is : 8
the 3-th element is : 9
the 4-th element is : 10
我的问题: 为什么看起来程序在您输入后执行了所有打印语句?
那么程序是否会在您按<Enter>换行后“保留”打印语句以显示它们?在某处对这种行为有更好的解释吗?
【问题讨论】: