Write your question here.
I need assistance in writing a statement(s) for the following instances
1.declare an array of 50 elements of type int called alpha
2.declare another 2 dimensional array aplha2D with 10 columns and 5 rows
3.Write a nested for loop to copy the elements of the array aplha into the rows of alpha2D i.e the first 10 elements go to the first row,second 10 elements go to the second row and so forth,until all the elements have been copied over.
My answers are as follows:
1.alpha[50];
2.alpha2D[5][10];
3.I am stuck with this question as I am not sure how to copy the elements of alpha to aplha2D
for(int col = 0; col < 10; col++)
for(int row = 0; row < 5; row++)
// first call [0][0], then [0],[1] ... [9],[4] (remember indexing is 1-off from number)
// since alpha is contiguous, alpha[col * 5 + row] will increment [0] -> [49]