Tic-Tac-Toe游戏的C语言二维数组为什么出错*
第一个错误:8 22 I:\C语言学习文件\学习\Tic-tac-toe游戏网上版.cpp [Error] use of parameter outside function body before ‘]’ token
第二个错误:35 22 I:\C语言学习文件\学习\Tic-tac-toe游戏网上版.cpp [Error] ‘num’ was not declared in this scope
第三个错误:40 8 I:\C语言学习文件\学习\Tic-tac-toe游戏网上版.cpp [Error] ‘a’ was not declared in this scope
#include /*Tic-Tac-Toe游戏,主函数输入一个棋盘规模大小,
然后接着输入目前棋盘的形态,
然后调用judge函数,判断游戏是否结束的简单小游戏程序。
主要考察二维数组和标记变量的知识点。*/
int judge(int num,int a[num][num]); //函数声明
int main(void){
int num; //棋盘的大小
while (scanf("%d", &num) != EOF) //这是什么判断?
{
int a[num][num]; //输入棋盘内的数字
for(int i=0; i
8 28 I:\C语言学习文件\学习\Tic-tac-toe游戏网上版.cpp [Error] use of parameter outside function body before ‘]’ token
8 33 I:\C语言学习文件\学习\Tic-tac-toe游戏网上版.cpp [Error] use of parameter outside function body before ‘]’ token
32 28 I:\C语言学习文件\学习\Tic-tac-toe游戏网上版.cpp [Error] use of parameter outside function body before ‘]’ token
32 33 I:\C语言学习文件\学习\Tic-tac-toe游戏网上版.cpp [Error] use of parameter outside function body before ‘]’ token
I:\C语言学习文件\学习\Tic-tac-toe游戏网上版.cpp In function ‘int judge(…)’:
35 22 I:\C语言学习文件\学习\Tic-tac-toe游戏网上版.cpp [Error] ‘num’ was not declared in this scope
40 8 I:\C语言学习文件\学习\Tic-tac-toe游戏网上版.cpp [Error] ‘a’ was not declared in this scope
53 23 I:\C语言学习文件\学习\Tic-tac-toe游戏网上版.cpp [Error] ‘num’ was not declared in this scope
58 9 I:\C语言学习文件\学习\Tic-tac-toe游戏网上版.cpp [Error] ‘a’ was not declared in this scope
74 19 I:\C语言学习文件\学习\Tic-tac-toe游戏网上版.cpp [Error] ‘num’ was not declared in this scope
76 8 I:\C语言学习文件\学习\Tic-tac-toe游戏网上版.cpp [Error] ‘a’ was not declared in this scope
82 12 I:\C语言学习文件\学习\Tic-tac-toe游戏网上版.cpp [Error] ‘num’ was not declared in this scope
90 19 I:\C语言学习文件\学习\Tic-tac-toe游戏网上版.cpp [Error] ‘num’ was not declared in this scope
92 8 I:\C语言学习文件\学习\Tic-tac-toe游戏网上版.cpp [Error] ‘a’ was not declared in this scope
98 12 I:\C语言学习文件\学习\Tic-tac-toe游戏网上版.cpp [Error] ‘num’ was not declared in this scope
a 和num 在函数声明中都定义了int 类型了呀
为什么还会出错**