📜  如何在 C++ 代码示例中使用 new 初始化数组

📅  最后修改于: 2022-03-11 14:44:50.045000             🧑  作者: Mango

代码示例1
int* a = NULL;   // Pointer to int, initialize to nothing.
int n;           // Size needed for array
cin >> n;        // Read in the size
a = new int[n];  // Allocate n ints and save ptr in a.
for (int i=0; i