How can I find the number of elements in an array?

前端 未结 14 1194
广开言路
广开言路 2020-12-02 15:01

I have an int array and I need to find the number of elements in it. I know it has something to do with sizeof but I\'m not sure how to use it exac

14条回答
  •  死守一世寂寞
    2020-12-02 16:04

    Actually, there is no proper way to count the elements in a dynamic integer array. However, the sizeof command works properly in Linux, but it does not work properly in Windows. From a programmer's point of view, it is not recommended to use sizeof to take the number of elements in a dynamic array. We should keep track of the number of elements when making the array.

提交回复
热议问题