Add time.h
to the top and declare the function parameters as a pointer to a pointer and it should work.
Right now you have a triple pointer (a 2d array of pointers). Change it to int ** matrix
for all similar parameters.
Similarly, remove all prepended asterisks from matrix operations inside your function:
matrix[i][j] = *matrixA[i][j] + *matrixB[i][j];
should be
matrix[i][j] = matrixA[i][j] + matrixB[i][j];
I removed brackets so the answer isn't excessively long, you probably should keep them in your code.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define ROWS 10
#define COLUMNS 10
void fillMatrix (int **matrix, int rows, int columns)
{
int i, j;
for(i = 0; i < rows; i++)
for(j= 0; j < columns; j++)
matrix[i][j] = (rand() % 10) + 1;
}
void printMatrix (int **matrix, int rows, int columns)
{
int i, j;
for(i = 0; i < rows; i++)
{
for(j= 0; j < columns; j++)
printf("%2d ", matrix[i][j]);
printf("\n\n");
}
}
void sumMatrix (int **matrix, int **matrixA, int **matrixB, int rows, int columns)
{
int i, j;
for(i = 0; i < rows; i++)
for(j = 0; j < columns; j++)
matrix[i][j] = matrixA[i][j] + matrixB[i][j];
}
int main()
{
//...
}