next up previous contents index
Next: Strings Up: Predefined functions Previous: Formatted output conversion


Three memory allocation and free functions are predefined in Smac (see also strdup() §6.6.3 page gif):


   void * malloc(int size)

malloc returns a pointer on a block of at least size bytes correctly aligned, or 0 on failure (see §6 page gif).


   void * calloc(int nelt, int eltsize)

calloc returns a pointer to a zero initialized block able to memorize nelt elements of size eltsize, or 0 on failure.


   void free(void * ptr)

free releases a block allocated by malloc or calloc.

For performance reasons, a copy function has also been predefined:


   char * memcpy(char * to, char * from, int n)

memcpy copies n bytes from from to to.

Lionel Fournigault
Mon Mar 6 13:33:34 MET 1995