In: Computer Science
write a function declaration for a 2d array where each row size is 8 and the function does not return anything.
Code Language is not given so I am considering C language.
As mentioned in question function does not return anything that
means its return type should be is void. Function name is not
mentioned so I am taking function name as print2dArray.
In question only row size 8 is given so I am taking 2 as column
size.
so with all above consideration the function declaration for a 2d array where each row size is 8 and the function does not return anything is as follows.
void print2dArray(int arr[8][2]);
just to demonstrate I have added following C code as well.
#include <stdio.h>
void print2dArray(int arr[8][2]);
int main()
{
int arr[][2] = { {1, 2}, {3, 4}, {5, 6}, {7, 8}, {9, 10}, {11, 12}, {13, 14}, {15, 16} };
print2dArray(arr);
return 0;
}
void print2dArray(int arr[8][2])
{
int i, j;
for (i = 0; i < 8; i++)
for (j = 0; j < 2; j++)
printf("%d ", arr[i][j]);
}