Interface: reduced standard C library. More...
#include <mem.h>
Go to the source code of this file.
Functions | |
void * | calloc (size_t nmemb, size_t size) |
allocate and return pointer to initialized memory | |
void * | malloc (size_t size) |
allocate and return pointer to uninitialized memory | |
void | free (void *ptr) |
return the allocated memory to memory management. | |
long int | random (void) |
generate a random number | |
void | srandom (unsigned int seed) |
seed the random number generator | |
Interface: reduced standard C library.
This file describes the public programming interface for memory management services and random number services
Definition in file stdlib.h.
allocate and return pointer to initialized memory
calloc() allocates memory for an array of {nmemb} elements of {size} bytes each and returns a pointer to the allocated memory. The memory is filled with zero values.
nmemb | the number of members to allocate |
size | the size (in bytes) of each member to be allocated |
NOTE: content of the returned memory is initialized by this routine
|
extern |
return the allocated memory to memory management.
free() frees the memory space pointed to by {ptr}, which must have been returned by a previous call to malloc(), or calloc(). Other- wise, or if free(ptr) has already been called before, undefined behaviour occurs. If ptr is NULL, no operation is performed.
ptr | a pointer to previously allocated memory |
|
extern |
allocate and return pointer to uninitialized memory
malloc() allocates {size} bytes of memory and returns a pointer to it.
size | the number of bytes of memory to be allocated |
NOTE: content of the returned memory is not initialized by this routine
|
extern |
generate a random number
The random() function returns successive pseudo-random numbers
|
extern |
seed the random number generator
The srandom() function sets its argument as the seed for a new sequence of pseudo-random integers to be returned by random(). These sequences are repeatable by calling srandom() with the same seed value. If no seed value is provided, the random() function is automatically seeded with a value of 1.
seed |
brickOS is released under the
Mozilla Public License.
Original code copyright 1998-2005 by the authors. |