samedi 19 octobre 2019

Program does not compile: incompatible types in assignment of ‘int (*)[3][3]’ to ‘int [9][3][3]’

I have a class board:

class board{
private:
    int data[9][3][3] = {};

public:
    board(int dataa[9][3][3]);
};

board::board(int dataa[9][3][3]){
    this->data = dataa; // error from title here!

I think the error might have something to do with the fact that an array is itself a pointer so it may interfere with types, but the code looks like it should work given that the constructor's argument type dataa is identical to data's type. Any help is appreciated.

Aucun commentaire:

Enregistrer un commentaire