dynamically change the size of an array c++

后端 未结 3 1016
逝去的感伤
逝去的感伤 2021-01-24 13:56

I have an array defined as;

static double Temp_data[TABLE_SIZE];

I want to change the size of the array according to the user input.

3条回答
  •  感情败类
    2021-01-24 14:24

    T *pData

    pData = new T[NUM_ELEMENTS];

    Basically using the new operator. Read more about new from any C++ reference

提交回复
热议问题