size of dynamically allocated array

后端 未结 4 2071
醉话见心
醉话见心 2020-12-09 10:54

Is it true that a pointer assigned to the starting address of a dynamically allocated array does not have the information of the size of the array? So we have to use another

4条回答
  •  盖世英雄少女心
    2020-12-09 11:33

    Yes, it's true. This is part of why you should rarely try to deal with this directly, and use a standard container instead. About the only time it makes sense to deal with it is if you decide to implement a container yourself (in which case you'll normally track the size information in your container's implementation).

提交回复
热议问题