// gcc x.c #define _GNU_SOURCE #include #include #define free myfree void myfree(void *ptr); void myfree(void *ptr){ printf("my free called\n"); } void foo() { char *s = (char *)malloc(100); sprintf(s, "%s", "hello there"); printf("'%s'\n", s); free(s); } void main(void){ foo(); }