0

Program which accepts 2D array of integers and its size as arguments and displays the elements of middle row and middle column??

eg: if array is 3 5 4 7 6 9 2 1 8 output : middle row : 7 6 9 middle column : 5 6 1

26th Mar 2017, 11:44 AM
M G
M G - avatar
1 Antwort
+ 1
void printMiddle(int[][] arr, int size){ int i = 0; printf("middle row: "); for (i=0;i<size;i++){ printf("%d ", arr[size/2][i]; } printf("\nmiddle column: "); for (i=0;i<size;i++){ printf("%d ", arr[i][size/2]; } }
11th Apr 2017, 9:13 AM
Konstantinos Charalambous
Konstantinos Charalambous - avatar