Seth Lamb wrote:
I am really close to finishing this program and my output is almost there, except it's only printing out the first half or so of the array. I have two for loops and two counters to determine the size of the array and then copy the multidimensional array's values into the 1D array, but it only prints out the first half of the array as such:
You iterate through each "row" of the "two dimensional" array and ...
1. Copy one row of the "2D" array into the "one dimensional" array ... looks good.
2. Calculate the new index of the "one dimensional" array ... looks good.
3. Print one value of the "one dimensional" array... huh?? You just copied a whole row, so how does printing one value represent the whole row the you just copied?
3b. To print the one value, you used the m index on the "one dimensional" array ... huh?? Isn't the m index used to dereference a row of the "2D" array? How can it now be applied to the "1D" array?
[EDIT] Oops. Didn't noticed that Liutauras had already answered with a hint (which is probably better as it makes the OP think it through). Sorry. Have a cow ...
Henry