Question: Two Dimensional Arrays Functions Exercise for C++ Provide functions which do the following: initialize a four by four array of integers to zero randomly assign

Two Dimensional Arrays Functions Exercise for C++

Provide functions which do the following:

initialize a four by four array of integers to zero

randomly assign values to a two by three array

randomly assign values to a four by four array

print out a four by four array of integers

sum the elements of a four by four array of integers

sum the elements of a two by three array of integers

sum the values of each row of a two by three array of integers and return a one dimensional array with these values

sum the values of each row of a four by four array of integers and return a one dimensional array with these values

Test each of these functions appropriately.

Code on C:

#include #include

void print2DArray(int array[2][3]); void intToZero2D(int array[2][3]); int main(int argc, char *argv[]) { int array1[2][3]={{1,2,3}, {4,5,6}};

int array2[4][4];

print2DArray(array1); print2DArray(array2);//array size does not match intToZero2D(array1);//sets array to zero intToZero2D(array2); print2DArray(array1);//print to show the elements went to zero print2DArray(array2);

return 0; } void print2DArray(int myArray[2][3]) { int row; int column; for(row =0; row < 2; row++){ for(column = 0; column < 3; column++){ printf("%d\t", myArray[row][column]); //printf(" [%d][%d] = %d ", row, column, myArray[row][column]); } printf(" "); } } void intToZero2D(int yourArray[2][3]){ int row; int column; for(row=0;row<2;row++){ for(column=0;column<3;column++){ yourArray[row][column] = 0; } } }

/* */

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!