Go to the first, previous, next, last section, table of contents.


xrealloc

Syntax

#include <stdlib.h>

void *xrealloc(void *ptr, size_t size);

Description

This function is just like realloc (see section realloc), except that if there is no more memory, it prints an error message and exits. It can also properly handle ptr being NULL.

Return Value

A pointer to a possibly new block.

Portability

not ANSI, not POSIX

Example

char *buf;
buf = (char *)xrealloc(buf, new_size);


Go to the first, previous, next, last section, table of contents.