错误:无法将类型“ void *”的值分配给类型“ float **”的实体

时间:2018-12-15 15:52:07

标签: c++

我正在尝试使用此函数初始化一个二维数组

void initialize(int n,int m, float **v){
  v = malloc(n * sizeof(float *));//problem here
  int i,j;
  for (i=0; i<m; i++) {
    v[i] = malloc(m * sizeof(float));//problem here
  }

    for(i=0 ;i<n; i++){
        for(j=0 ;i<m; j++){
            v[i][j] = rand()%11;
        }
    }
}

我收到此错误

error: a value of type "void *" cannot be assigned to an entity of type "float **"

error: a value of type "void *" cannot be assigned to an entity of type "float *"

有什么问题吗?

0 个答案:

没有答案