memory.c
来自「标准c库代码,可以应用于各个系统提供了大量的基本函数」· C语言 代码 · 共 39 行
C
39 行
/* WinBond bug report malloc() returns 0x0. test the memory calls. These test sbrk(), which is part of glue.c for most architectures. */#include <stdio.h>#define BUFSIZE 80main(){ char *buf; char *tmp; char *result; /* see if we can get some memory */ buf = (char *)malloc(BUFSIZE); if (buf != 0x0) { pass ("malloc"); } else { fail ("malloc"); } /* see if we can realloc it */ tmp = buf; result = (char *)realloc (buf, BUFSIZE+100); if ((buf != 0x0) && (result != 0x0)) { pass ("realloc"); } else { fail ("realloc"); } /* see if we can free it up. FIXME: how to test free ?*/ free (buf); fflush (stdout);}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?