#include
#include
#include
using namespace std;
int main()
{
//malloc 和free 使用 c语言中使用
void * const p=malloc(sizeof(char)*4);
free(p);
char*p3 = (char *)malloc(10*sizeof(char));
strcpy_s(p3,10,"fe");
cout << *p3 << endl;
free(p3);
//c++中不再使用malloc和fre分配内存,必须使用new和delete分配内存 比如在c++中对象的new中使用了new调用构造函数进行构造新的对象
//null 和nullptr 实际上是不同的类型
cout << typeid(NULL).name() << endl;
cout << typeid(nullptr).name() << endl;
//对于指针的初始化以后最好不要用null进行初始化了,要用nullptr进行取代
system("pause");
return 0;
}