This problem is a continuation of a previous problem:
http://stackoverflow.com/questions/402432/c-returning-and-inserting-a-2d-array-object
and it is highly recommended to view the link to understand the following.
I followed through Adam Rosenfield's answer and it solved the first two problems. However the last problem is not yet to be solved which high involves on the first two. I am uncertain if the problem is how I attempt to right the code, or if there is a problem in what is being attempted.
This is a section of what is written in the int main():
int i, j;
Grid myGrid;
Piece myPiece;
//First two lines of Adam's Code
int (*arrayPtr)[4][4] = myPiece.returnPiece();
int cell = (*arrayPtr)[i][j];
//compiler error
myGrid.insertArray(cell); <--- Problem
I am uncertain if it is the argument that is wrong, or if it is something that I'm attempting that is wrong. This is what I receive when I tried to compile:
In function `int main()' invalid conversion from `int' to `int(*)[4][4]' initializing argument 1 of `void Grid::insertArray(int(*)[4][4])' [Build Error] [grid test.o] Error 1
I have tried these:
myGrid.insertArray((*arrayPtr)[4][4]); //Same Error myGrid.insertArray((*arrayPtr)[i][j]); //Same Error
I am unsure what is the problem and uncertain on what to do. I thank Adam and the other for helping me with the previous problems, but does anyone know how to solve this last problem?
"having returnpiece() be accepted in the argument of insertArray();