꺄뜨르 2011. 5. 13. 23:40
#define MALLOC(p,s) if(!((p)=malloc(s))){fprintf(stderr,"메모리 충분치않음"); exit(EXIT_FAILURE);}

#define CALLOC(p, n, s)\
 if(!((p) = calloc(n, s))) {\
  fprintf(stderr, "Insufficient memory");\
  exit(EXIT_FAILURE);\

#define MALLOC(p,t,s)  if(!((p) = (t*)malloc(s))) { fprintf(stderr, "Insufficient memory"); exit(EXIT_FAILURE); }

MALLOC(pi, int, sizeof(int));