problem with sizeof operator

前端 未结 6 1835
遥遥无期
遥遥无期 2020-12-01 15:24

As i want to find array size dynamically in function, i used sizeof operator. But i got some unexpected result. here is one demo program to show you, what i want to do.

6条回答
  •  醉话见心
    2020-12-01 15:59

    you are getting the size of the pointer to the array. If you want the size of the array you have to multiply the number of elements by the size of each element.

提交回复
热议问题