 | C166 User's Guide |  |
|
|
| xmalloc| Summary |
#include <stdlib.h>
void xhuge *xmalloc (
unsigned long size); /* block size to allocate */
| | Description | The xmalloc function allocates a memory block from the memory pool of size bytes in length. Note | | Return Value | The xmalloc function returns a pointer to the allocated block or a null pointer if there is not enough memory to satisfy the allocation request. | | See Also | xcalloc, xfree, xinit_mempool, xrealloc | | Example |
#include <stdlib.h>
#include <stdio.h> /* for printf */
void tst_malloc (void) {
void xhuge *p;
p = xmalloc (1000); /* allocate 1000 bytes */
if (p == NULL)
printf ("Not enough memory space\n");
else
printf ("Memory allocated\n");
}
|
|
|