Static Matrix Casting to a pointer

后端 未结 2 1488
攒了一身酷
攒了一身酷 2021-01-27 01:00

I have matrix M:

float M[4][3] = {
    0, 0, 0,
    0, 1, 1,
    1, 0, 1,
    1, 1, 0};

And I need to cast M with the purpose of use the method

2条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-27 01:47

    Ok, the old best:

    float **M = new float*[4];
    for(int i=0; i<4; i++){
        M[i] = new float[3];
        for(int j=0; j<3; j++){
            M[i][j] = something...
        }
    }
    

提交回复
热议问题