malloc.c
来自「a software code for computing selected e」· C语言 代码 · 共 26 行
C
26 行
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <math.h>#include <ilupack.h>#include <ilupackmacros.h>void *MALLOC(size_t nbytes, char *msg ){ /* allocates space -- or exits in case of failure */ void *ptr; if (nbytes == 0) return NULL; ptr = (void *) malloc(nbytes); if (ptr == NULL) { fprintf(stderr,"Mem. alloc. ERROR in %s. Requested bytes: %ld bytes\n", msg, (long)nbytes ); fflush(stderr); exit( -1 ); } return ptr;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?