1 Star 0 Fork 1

X-OPEN/LwHeap

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.c 816 Bytes
一键复制 编辑 原始数据 按行查看 历史
xiaoguolin 提交于 2019-01-16 16:58 . 首次提交
#include "lwheap_port.h"
#include "lwheap.h"
int main()
{
lwheap_initial();
printf("free size: %d\n", lwheap_get_freesize(&__heap));
char* s0 = (char*)lw_malloc(30);
printf("free size: %d\n", lwheap_get_freesize(&__heap));
char* s1 = (char*)lw_malloc(20);
printf("free size: %d\n", lwheap_get_freesize(&__heap));
char* s2 = (char*)lw_malloc(50);
printf("free size: %d\n", lwheap_get_freesize(&__heap));
strcpy(s0, "Hello ");
strcpy(s1, "world!");
strcpy(s2, s0);
strcat(s2, s1);
strcat(s2, "\n");
printf(s2);
lw_free(s0);
printf("free size: %d\n", lwheap_get_freesize(&__heap));
lw_free(s1);
printf("free size: %d\n", lwheap_get_freesize(&__heap));
lw_free(s2);
printf("free size: %d\n", lwheap_get_freesize(&__heap));
return 0;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/X-OPEN/LwHeap.git
git@gitee.com:X-OPEN/LwHeap.git
X-OPEN
LwHeap
LwHeap
master

搜索帮助