+1  A: 

It's precisely this bunch of code:

int result = smallerArray.extractPiece();
largerArray.extractArray(result);
// ...
int Piece::extractPiece() {
    return **pieceArray;
}

Trying to pass an int to extractArray, which wants a pointer to a pointer, presumable your dynamic array, and not an int. Try changing it to

int **result = smallerArray.extractPiece();
largerArray.extractArray(result);
// ...
int ** Piece::extractPiece() {
    return pieceArray;
}

Only changing result to a pointer to pointer won't work. You of course also have to change what extractPiece returns (changing from int to int**)

Johannes Schaub - litb
It worked, but the problem is that now it smallerArray.extractPiece() now returns the address of the pointer to the pointer, while i want it to return to value, what can I do?
int value = **result;
ypnos
+1  A: 

Look, always at least for me it was easier to manage 2D arrays internally as 1D arrays where M[i,j]=A[i*N+j] where N is the number of cols (or rows, if the 2D arrays is row-column type). Users may get elements with the i,j indices but my class always store A[M * N] as private data. Passing 1-D pointer arrays is easier than managing 2-D pointer arrays (you can't fall in the pointer-to-pointer syntax which can get messy in some code).,

This is not related to this question, but since I don't know about specific compiler optimization instrinsics, I wonder if M[i,j] gets transformed to A[i] internally to use simpler addressing modes in the generated code.

Hernán