home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_10_06
/
1006018a
< prev
next >
Wrap
Text File
|
1992-04-09
|
352b
|
17 lines
/* calloc function */
#include <stdlib.h>
#include <string.h>
void *(calloc)(size_t nelem, size_t size)
{ /* allocate a data object on the heap and clear it
*/
const size_t n = nelem * size;
char *p = (char *)malloc(n);
if (p)
memset(p, '\0', n);
return (p);
}