#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define DEBUG
void* debug_malloc(size_t size);
#define MALLOC(n) debug_malloc(n)
int main() {
#ifdef DEBUG
char *p = MALLOC(64);
strcpy(p, "C Programming");
puts(p);
free(p);
#endif
return 0;
}
void* debug_malloc(size_t size) {
printf("debug_malloc - file: %s line: %d\n", __FILE__, __LINE__ + 1);
return (char*)malloc(size * sizeof(char));
}
/*
run:
debug_malloc - file: C:\Examples\src\main.c line: 28
C Programming
*/