Here I just want to define a function which returns the multiplication of matrices, with N arbitrary, I would like to generate a matrix with "new" command.
int **multiply(int **A, int **B, int N){
int **C=new int*[N];
for(int i=0;i<N;i++){
for(int j=0;j<N;j++){
for(int k=0;k<N;k++)
C[i][j]=C[i][j]+A[i][k]*B[k][j];
}
}
return (C);
}
The output looks like
Segmentation fault (core dumped)
whenever I assign values to C I have this error, could anybody tell me what happened and how to fix it?