Create a pointer to two-dimensional array

后端 未结 10 1425
温柔的废话
温柔的废话 2020-11-22 07:16

I need a pointer to a static 2-dimensional array. How is this done?

static uint8_t l_matrix[10][20];

void test(){
   uint8_t **matrix_ptr = l_matrix; //wron         


        
10条回答
  •  不知归路
    2020-11-22 07:40

    In

    int *ptr= l_matrix[0];
    

    you can access like

    *p
    *(p+1)
    *(p+2)
    

    after all 2 dimensional arrays are also stored as 1-d.

提交回复
热议问题