Write C code for the following questions. //a: array pointer, m: # of rows, n: # of columns void printMatrixRowMajor (in

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Write C code for the following questions. //a: array pointer, m: # of rows, n: # of columns void printMatrixRowMajor (in

Post by answerhappygod »

Write C Code For The Following Questions A Array Pointer M Of Rows N Of Columns Void Printmatrixrowmajor In 1
Write C Code For The Following Questions A Array Pointer M Of Rows N Of Columns Void Printmatrixrowmajor In 1 (73.95 KiB) Viewed 28 times
Write C code for the following questions. //a: array pointer, m: # of rows, n: # of columns void printMatrixRowMajor (int *a, int m, int n) { int row, col; int *ptr; printf("\nMatrix row major fashion: \n"); ptr = a; // ADD YOUR CODE HERE } //a: array pointer, m: # of rows, n: # of columns void printMatrixColMajor (int *a, int m, int n) { int row, col; int *ptr; printf("\nMatrix column major fashion: \n"); ptr = a; // ADD YOUR CODE HERE } main () { int m= 3, n = 4; int a [m] [n]; int row, col; for (row = 0; row < m; row++) for (col= 0; col < n; col++) a[row] [col] = row * n + co; (&a [0] [0], m, n); (&a [0] [0], m, n); printMatrixRowMajor printMatrixColMajor OUTPUT Matrix row major fashion: 0 1 2 3 4 5 6 7 8 9 10 11 Matrix column major fashion: 048 159 26 10 3 7 11 */ a) Use the pointer/addressing methods in row major fashion to display the array. Complete the function printMatrixRowMajor. b) Use the pointer/addressing methods in column major fashion to display the array. Complete function printMatrixColMajor
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply