I have a 2D array like this:
array a: (m)x(n)
1 2 3 4 5 6
2 3 4 5 6 7
3 4 5 6 7 8
4 5 6 7 8 9
and I want to insert this row to the beginning of the array:
row b: (1)x(n)
0 1 2 3 4 5
to get array like this:
array c: (m+1)x(n)
0 1 2 3 4 5
1 2 3 4 5 6
2 3 4 5 6 7
3 4 5 6 7 8
4 5 6 7 8 9
I tried this way:
- Create an empty array c:(m+1)x(n)
- Assign row b to first row of array c.
- Assign other rows of array a to array c.
It do well but I realize that it's to long. Can I do it shorter? And how?