C++ 中内存分配和回收

void Allocate(char* &p,int size) {
	p = (char*)malloc(size);
}

void Test(void) {
	char *str = NULL;
	Allocate(str,100);
	strcpy(str,"Hello World!");
	printf(str);
	free(str);
}

原文地址:https://www.cnblogs.com/wjchang/p/3671515.html