I want to insert 2-dimensional array into another 2-dimensional array- both are integer. The first one is smaller than the second then there is no error of size. The bigger have data for example to the middle of its own and second part has no data. I want to insert the second array in the middle of these data so that I need to push down the data in the bigger, meaning to copy non-zero part over the zero data. It would be appreciated if someone could offer related code in the most efficient way. for example:
int A[4][2] = {{1, 2} , {3, 4} , { 0, 0} , {0, 0} };
int B[2][2] = {{5, 6} , {7, 8}};
I want to insert B into A (between the first and second row) and push down the second row into the third row. Then we have:
int A[4][2] = {{1, 2} ,{5, 6} , {7, 8} , {3, 4} };
I want to do this without using nested loop.
std::vector<T>not an option for some reason?