How to add element to C++ array?

后端 未结 11 2456
旧时难觅i
旧时难觅i 2020-12-12 23:26

I want to add an int into an array, but the problem is that I don\'t know what the index is now.

int[] arr = new int[15];
arr[0] = 1;
arr[1] = 2;
arr[2] = 3;         


        
11条回答
  •  借酒劲吻你
    2020-12-13 00:09

    Initialize all your array elements to null first, then look for the null to find the empty slot

提交回复
热议问题