📄 ex1.c
字号:
#include<stdlib.h> //头文件
#include<stdio.h>
#include <reg51.h>
void main(void) //主函数
{
int *p; //指针指向整型元素
int *newp;
//初始化串口
p=malloc(15); //申请内存
if(p==NULL)
printf("Fail allocating array\n");
else
{
printf("New array address is %p\n",(void*)p); //输出地址
newp= realloc(p,20); //重新分配内存
if(newp==NULL)
printf("Fail allocating array\n");
else //输出地址
printf("New array address is %p\n",(void*)newp);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -