我正在学习 C 编程语言,在进行一些练习时,我遇到了有关 getch()
函数的错误!
这是我的代码:
#include <stdio.h>
#include <stdlib.h>
int main(){
int size = 6;
int markers[size];
int counter;
for (counter = 0; counter < size; counter++){
scanf("%d",&markers[counter]);
}
for (counter=0; counter < size; counter++){
printf("The element at %d is %d\n",counter,markers[counter]);
}
getch();
return 0;
}
最佳答案
getch()
不是 ANSI C 函数。您需要包含头文件 <conio.h>
使用它。或者最重要的是,只需使用符合 ANSI 的函数 getchar()
.
关于c - 我的程序(获取函数)有什么问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35242061/