calloc

Allocates and clears memory space for an array of objects

Local Servers:blocking
Remote Servers:N/A
Classification:ANSI
Service:Memory Allocation

Syntax

  #include <stdlib.h> 
  #include <nwmalloc.h> 
    
  void * calloc  (  
     size_t    n,   
     size_t    size);
  

Parameters

n
(IN) Specifies the number of objects.
size
(IN) Specifies the size (in bytes) of each object.

Return Values

calloc returns a pointer to the start of the allocated memory. The return value is NULL if insufficient memory is available or if the value of the size parameter is 0.

Remarks

The calloc function initializes all the memory to binary zeroes.

Memory allocation is not limited to 64 KB. The size parameter is 32 bits.

The calloc function calls the malloc function.

A block of memory allocated using the calloc function should be freed using the free function.

See Also

free, malloc

Example

  #include <nwmalloc.h>  
  #include <stdlib.h> 
   
  main ()  
  {  
     int      *memoryPointer;  
     size_t   n;  
     memoryPointer = calloc (n, sizeof (int));  
  }