malloc和free函数的使用
2024-08-31 06:03:24
#include <stdio.h>
#include <stdlib.h>
int main()
{
int *p,t;
p = (int *)malloc(40*sizeof(int));
if (!p){
printf("内存已用完!j");
exit(0);
}
for (t=0;t<40;++t) *(p+t)=t;
for (t=0;t<40;++t)
{
if (t%5==0)putchar('\n');
printf("%2d\t",*(p+t));
}
free(p);
return 0;
}
最新文章
- Javacript实现字典结构
- winform listbox与textbox组合提示框 模糊查询
- ASP.NET MVC学习之路由篇(3)
- android shape详解
- 九、CCAction
- 1.6Linux设备驱动
- 一、List的扩展
- c++对象内存布局
- ASP.NET Web API 通过参数控制返回类型(JSON|XML)
- openstack controller ha测试环境搭建记录(五)——配置rabbitmq集群
- 2n皇后问题
- [Swift]LeetCode542. 01 矩阵 | 01 Matrix
- python 内置数据类型之字符串
- android -------- 获取手机设备信息
- [Ubuntu] 如何设置静态 IP 和 DNS
- shell 8printf
- jQuery height()、innerHeight()、outerHeight()函数的区别详解
- python 3.x 爬虫基础---Requersts,BeautifulSoup4(bs4)
- 解决su – 后显示-bash-4.1#
- 双T滤波电路用于PWM方式DAC的分析