2D Arrays and Pointers - C

后端 未结 5 1849
春和景丽
春和景丽 2020-12-21 07:54

Just trying to really get my head round Arrays and Pointers in C and the differences between them and am having some trouble with 2d arrays.

For the normal 1D array

5条回答
  •  清酒与你
    2020-12-21 08:18

    In short, you cannot use { ... } as an initialiser for a scalar.

    char **arr_pointer declares a scalar, not an array. In contrast, the reason you can do char *arr = "constant"; is because you're still declaring a scalar, it just happens to point at a string literal.

提交回复
热议问题