English
Language : 

CC78K0S Datasheet, PDF (216/520 Pages) NEC – C Compiler Ver.1.30 or Later Language
CHAPTER 10 LIBRARY FUNCTIONS
5-3 calloc
Utility Functions
FUNCTION
The memory function calloc allocates an array area and then initializes the area to 0.
HEADER
stdlib.h
FUNCTION PROTOTYPE
void *calloc(size_t nmemb,size_t size);
Function
calloc
Arguments
nmemb ... Number of
members in the array
size ... Size of each member
Return Value
• Pointer to the beginning of
the allocated area if the
requested size is allocated
• Null pointer if the requested
size is not allocated
EXPLANATION
• The calloc function allocates an area for an array consisting of n number of members (specified by nmemb),
each of which has the number of bytes specified by size and initializes the area (array members) to zero.
• Returns the pointer to the beginning of the allocated area if the requested size is allocated.
• Returns the null pointer if the requested size is not allocated.
• The memory allocation will start from a break value and the address next to the allocated space will become a
new break value. See 5-11 brk for break value setting with the memory function brk.
216
User’s Manual U14872EJ1V0UM