#include <iostream>
using namespace std;
int main()
{
int i,j;
int * k;
char m;
do{
cin >> j;
k = new int[j];
for (i = 0; i < j; i++){
k[i] = i;
cout << k[i] << ", ";
}
delete[] k;
cout << "\nContinue?\n";
cin >> m;
}while (m != 'n');
}
这是我为描述我在理解new
和delete
. 'k' 会产生内存泄漏吗?