The following C++ code:
int iBlocks[9][2];
class System{
void setBlocks(){
int iUCtr = 0;
int iUYCtr = 105;
while(1){
int iUXCtr = 180;
while(1){
iBlocks[iUCtr] = 0; //error happens here.
iBlocks[iUCtr][0] = iUXCtr;
iBlocks[iUCtr][1] = iUYCtr;
iUCtr += 1;
iUXCtr += 120;
if(iUXCtr>420) break;
}
iUYCtr += 120;
if(iUYCtr>345) break;
}
}
public:
System(){
setBlocks();
cout << "Block settings set..." << endl;
}
};
MinGW g++ produces this error:
incompatible types in assignment of `int' to `int[2]'
The problem is at iBlocks[iUCtr] = 0;.
When I changed iBlocks to a pointer, it worked. Can someone explain to me what is going on under the hood?
The line
iBlocks[iUCtr] = 0;is not required. Delete it.