컴퓨터 과학 & 영상처리 관련/자료구조 / 알고리즘
MALLOC
꺄뜨르
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));
#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));