/* This program uses code from "Algorithms in C, Third Edition," * by Robert Sedgewick, Addison-Wesley, 1998. */ #include #include "twoD_arrays.h" main() { srand(time(NULL)); const int rows = 3; const int cols = 4; int ** matrix1 = randomMatrix(rows, cols, 10); printf("matrix1:\n"); printMatrix(matrix1, rows, cols); int ** matrix2 = randomMatrix(rows, cols, 10); printf("matrix2:\n"); printMatrix(matrix2, rows, cols); int ** matrix3 = addMatrices(matrix1, matrix2, rows, cols); printf("matrix1 + matrix2:\n"); printMatrix(matrix3, rows, cols); free2d(matrix1, rows, cols); free2d(matrix2, rows, cols); free2d(matrix3, rows, cols); return 0; }