我将一个二维数组传递给 mark 函数。
void mark(int n, int m, int i, int j, int canvisit[][m], int a[][m]){}
这段代码在 Codeblocks 上的 C 中运行良好,但在 C++ 中,我收到如下错误:
prog.cpp:9:55: error: use of parameter outside function body before ']' token
void mark(int n, int m, int i, int j, int canvisit[][m], int a[][m]){
^
prog.cpp:9:56: error: expected ')' before ',' token
void mark(int n, int m, int i, int j, int canvisit[][m], int a[][m]){
^
prog.cpp:9:58: error: expected unqualified-id before 'int'
void mark(int n, int m, int i, int j, int canvisit[][m], int a[][m]){
我在这里做错了什么吗?我之前给出的列数为int m
,这在 C 中有效,但在 C++ 中无效。任何帮助将不胜感激。