"void" 类型的值不能用于初始化 "double**" 类型的实体

a value of type "void" cannot be used to initialize an entity of type "double**"

我用的是C语言,malloc有问题


  double** matrix = malloc(matrixSize * sizeof(double*));

  for (size_t i = 0; i < matrixSize; i++) {
    matrix[i] = malloc(matrixSize * sizeof(double));
  }

  return matrix;
}`

malloc returns 空指针

void *malloc(size_t size);

因此您必须将其类型转换为 double**

double** matrix = (double**)malloc(matrixSize * sizeof(double*));