cetc_heap_test.c
来自「linux 数据结构堆栈操作。。 。。 。。 。」· C语言 代码 · 共 36 行
C
36 行
#include <stdio.h>#include <string.h>#include <stdlib.h>#include <unistd.h>#include "cetc_heap.h"typedef struct _tagMsg tagMsg;struct _tagMsg{ int owner; int msgid; int wparam; int lparam;};int main(){ tagPrivHeap heap; tagMsg *msg; int i; cetc_init_privheap(&heap, 64, sizeof(tagMsg)); for(i=0; i<64; i++) { msg =(tagMsg *)cetc_alloc_from_privheap(&heap); printf("msg addr=%p\n", msg); } msg =(tagMsg *)cetc_alloc_from_privheap(&heap); printf("msg addr=%p\n", msg); cetc_free_to_privheap(&heap, msg); cetc_destroy_privheap(&heap); return 0;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?