 | C166 User's Guide |  |
|
|
| malloc| Summary | | | Description | The malloc function allocates a memory block from the memory pool of size bytes in length. Note | | Return Value | The malloc 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 | calloc, free, init_mempool, realloc | | Example |
#include <stdlib.h>
#include <stdio.h> /* for printf */
void tst_malloc (void) {
unsigned char far *p;
p = malloc (1000); /* allocate 1000 bytes */
if (p == 0)
printf ("Not enough memory space\n");
else
printf ("Memory allocated\n");
}
|
|
|