How could I accomplish copying one jagged array to another? For instance, I have a 5×7 array of:
0, 0, 0, 0, 0, 0, 0
0, 0, 0, 0, 0, 0, 0
0, 0, 0, 0, 0, 0, 0
0, 0, 0, 0, 0, 0, 0
0, 0, 0, 0, 0, 0, 0
and a 4×3 array of:
0,1,1,0
1,1,1,1
0,1,1,0
I would like to be able to specify a specific start point such as (1,1) on my all zero array, and copy my second array ontop of it so I would have a result such as:
0, 0, 0, 0, 0, 0, 0
0, 0, 1, 1, 0, 0, 0
0, 1, 1, 1, 1, 0, 0
0, 0, 1, 1, 0, 0, 0
0, 0, 0, 0, 0, 0, 0
What would be the best way to do this?
Due to the squared nature of your example, this seems more fitting of a 2D array instead of jagged. But either way, you could certainly do it the old fashioned way and loop over it. Something like (untested)
Edit: Like Mark, I also had a slight improvement, slightly different but along the same lines.