c define arrays in struct with different sizes

前端 未结 3 1175
南方客
南方客 2021-01-21 09:08

I need to define a struct for two types of objects. Both have exactly the same data structure and perform same tasks (member methods).

The ONLY difference is that the a

3条回答
  •  说谎
    说谎 (楼主)
    2021-01-21 10:02

    Have the arrays be pointers and allocate to them (the appropriate size) as needed. Only downsize is access to the 2D array will be a little clumsy.

提交回复
热议问题