Computer Science – 10.2 Arrays | e-Consult
10.2 Arrays (1 questions)
Login to see all questions.
Click on a question to view the answer
Function: GetFirstRow(array)
Input: 2D array of integers (array)
Output: 1D array of integers
- If array is empty then:
- Return an empty 1D array
- End If
- Initialize newArray as a 1D array of size equal to the number of columns in the first row of the input array.
- For i = 0 to number of columns - 1 do:
- newArray[i] = array[0][i]
- End For
- Return newArray