int *array = new int[n]; what is this function actually doing?

后端 未结 8 1213
生来不讨喜
生来不讨喜 2020-12-03 05:00

I am confused about how to create a dynamic defined array:

 int *array = new int[n];

I have no idea what this is doing. I can tell it\'s c

8条回答
  •  生来不讨喜
    2020-12-03 05:36

    It allocates that much space according to the value of n and pointer will point to the array i.e the 1st element of array

    int *array = new int[n];
    

提交回复
热议问题