#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
void adder(int **matrix1, int **matrix2, int **matrix3) {
for(int i = 0; i < 3; i++){
for(int j = 0; j < 3; j++){
matrix3[i][j] = matrix1[i][j] + matrix2[i][j];
}
}
}
int main() {
int matrix1[3][3] = {{1,1,1},{1,1,1},{1,1,1}};
int matrix2[3][3] = {{2,2,2},{2,2,2},{2,2,2}};
int matrix3[3][3];
adder(matrix1, matrix2, matrix3);
for(int i = 0; i < 3; i++){
for(int j = 0; j < 3; j++){
printf("%d\t", matrix3[i][j]);
}
printf("\n");
}
}
When doing this there are no errors but warning saying "passing argument from incompatible pointer". I've tried working with the adder inputs as pointers using int *matrix1 but this doesn't work either.
What can I do?