#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
/******指针动态分配内存***********/
int *p;
p = new int;//p = (int*)malloc(sizeof(int)); void*
delete p;
/******一维数组动态分配内存***********/
int *pArray;
pArray = new int[5];
delete [] pArray;
/******多维维数组动态分配内存***********/
int (*pa)[3];
pa = new int[12][3];
delete [] pa;
return 0;
}
C++动态分配内存释放内存
最新推荐文章于 2024-09-19 11:31:41 发布