debugmalloc.h
来自「ssd6课程练习3的完全答案」· C头文件 代码 · 共 32 行
H
32 行
#ifndef DEBUGMALLOC_H
#define DEBUGMALLOC_H
#include <stdlib.h>
/* Macros that will call the wrapper functions with
the current filename and line number */
#define MALLOC(s) MyMalloc(s, __FILE__, __LINE__)
#define FREE(p) MyFree(p, __FILE__, __LINE__)
/* Wrappers for malloc and free. You will implement
these functions. */
void *MyMalloc(size_t size, char *filename, int linenumber);
void MyFree(void *ptr, char *filename, int linenumber);
/* Required function for detecting memory leaks */
int AllocatedSize(); /* returns number of bytes allocated */
/* Optional functions if you wish to implement the global list */
void PrintAllocatedBlocks();
int HeapCheck(); /* returns 0 if all blocks have not been corrupted,
-1 if an error is detected */
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?