当前位置:编程学习 > C/C++ >>

C++学习笔记之指针

#include<iostream>
#include<malloc.h>
using namespace std;

int main()
{
	int *p = NULL;
	p = (int*)malloc(sizeof(int));
	*p = 4;
	free(p);
	printf("%d\n",p);
	if(p != NULL)
	{
		printf("%d\n",*p);
	}
	return 0;
}

 

补充:软件开发 , C++ ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,