2D Arrays and Pointers - C

后端 未结 5 1838
春和景丽
春和景丽 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:21

    Quote from Wikipedia:

    In computing, a scalar variable or field is one that can hold only one value at a time... ...For example, char, int, float, and double are the most common scalar data types in the C programming language.

    So as Oli Charlesworth pointed out in his reply using {.....} initializes multiple items but as char **arr_pointer is a 'scalar' and so can only point at 1 thing at a time (an address) then the {...} notation cannot work here.

提交回复
热议问题