#include <stdio.h> #include <stdlib.h> /* Allocate and return a pointer to n consecutive bytes of memory. */ void *mymalloc(size_t n) { void *p = malloc(n); if (p == NULL) { printf("Can't allocate %u bytes.\n", n); exit(EXIT_FAILURE); } return p; }