int** matrix1 = (int**)malloc(rows * sizeof(int*));
int** matrix2 = (int**)malloc(rows * sizeof(int*));
int** result = (int**)malloc(rows * sizeof(int*));
for (int i = 0; i < rows; i++) {
matrix1[i] = (int*)malloc(cols * sizeof(int));
matrix2[i] = (int*)malloc(cols * sizeof(int));
result[i] = (int*)malloc(cols * sizeof(int));
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
matrix1[i][j] = i * cols + j + 1;
matrix2[i][j] = (rows * cols) - (i * cols + j);
addMatrices(matrix1, matrix2, result, rows, cols);
printMatrix(matrix1, rows, cols);
printMatrix(matrix2, rows, cols);
printf("Resultant Matrix:\n");
printMatrix(result, rows, cols);
for (int i = 0; i < rows; i++) {