Just think of the problem as having an array of Foo.
#define MAX_NUM 64
Foo Stamps[MAX_NUM];
And now you want to copy a Foo.
unsigned char *DynArr = new unsigned char[sizeof(Foo)];
std::memcpy(DynArr, &Stamps[row], sizeof(Stamps[row]));
This would "work" for any type Foo. In your case, Foo is a 3-D array.
typedef unsigned char Foo[16][16][3];
@eeroika's answer works correctly, because when Foo is an array, an instance of it will decay to a value equal to the address of its first element. For arrays, the address of its first element is the same as the address of the array itself. However, if Foo were a non-array type, you would need to use the address-of operator.
std::memcpywould be sufficient.int[100][100]to aint[10][10]. I can't even understand if it's about copying a row and then reshaping it to a 10x10, or if it's about copying a submatrix... This question is much simpler since it's basically copying a row ofStampsand flattening it... And since the layout is contiguous, it's basicallystd::memcpy(DynArr, Stamps[istamp], sizeof *Stamps);.unsigned char (*DynArr)[16][3] = new unsigned char[16][16][3];This works as long as the sizes of the inner dimensions are compile time constants (16and3), the outer dimension size (here also16) can be supplied at runtime and is omitted from the type ofDynArr.