defining a 2D array with malloc and modifying it

前端 未结 7 1175
陌清茗
陌清茗 2020-12-01 13:43

How do i define a 2D array using malloc ? (lets say 10X20).

second, can i increase number of rows or cols without creating a new increased array and copying all data

7条回答
  •  春和景丽
    2020-12-01 13:47

    second, can i increase number of rows or cols without creating a new increased array and copying all data to it?

    No, you can't change the size of an array. What you can do is use pointers and realloc to do so.

提交回复
热议问题