【发布时间】:2015-06-25 08:19:44
【问题描述】:
所以我不知道为什么我会在我标记的行显示“错误:类型为“颜色”的参数与类型为“颜色(*)[2]”的参数不兼容
p>#include <iostream>
using namespace std;
enum color{black, white};
bool negative(color a[2][2], color b[2][2]);
void main(){
color a[2][2] = { { black, white }, { white, black } };
color b[2][2] = { { white, black }, { black, white } };
negative(a[2][2], b[2][2]); //<==== here (under "a" and "b")
}
bool negative(color a[2][2], color b[2][2]){
int False=0, True=0;
for (int i = 0; i < 2; i++){
for (int j = 0; j < 2; j++){
if (a[i][j] != b[i][j]) True++;
else False++;
}
}
if (True == 2 && False == 0)return true;
else if (True == 0 && False == 2)return false;
}
【问题讨论】:
-
拜托,拜托,请写一个更好的标题。我通常会跳过标题不具描述性的问题。
-
这样调用你的函数:
negative(a, b);