I use C language and I have problem with malloc
double** matrix = malloc(matrixSize * sizeof(double*));
for (size_t i = 0; i < matrixSize; i ) {
matrix[i] = malloc(matrixSize * sizeof(double));
}
return matrix;
}`
CodePudding user response:
malloc returns a void-pointer
void *malloc(size_t size);
so you will have to typecast this to double**
double** matrix = (double**)malloc(matrixSize * sizeof(double*));