定义: 申请和释放内存
申请内存(new)
int *p = new int;
int *arr = new int[10];释放内存(delete)
delete p;
delete []arr;
Tips:C语言中使用malloc申请内存, free释放内存,不可和C++混搭
定义: 申请和释放内存
申请内存(new)
int *p = new int;
int *arr = new int[10];
释放内存(delete)
delete p;
delete []arr;
Tips:C语言中使用malloc申请内存, free释放内存,不可和C++混搭