what is the default value of an array in C++?

前端 未结 5 1377
情歌与酒
情歌与酒 2021-01-06 09:12

If I were to create an array with int* array = new int[10]; and fill part of the array with values, how can I check how much of the array is filled? I want to l

5条回答
  •  伪装坚强ぢ
    2021-01-06 09:26

    The default value of array is indeterminate means garbage.

    how can I check how much of the array is filled?

    You cannot check, C/C++ has no array bounds check. You have to do it yourself.You need to keep track of the data inserted by a user. When your counter reaches the size of the array, the array is full

提交回复
热议问题