home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Interactive Guide
/
c-cplusplus-interactive-guide.iso
/
c_ref
/
csource3
/
163_01
/
calloc.c
< prev
next >
Wrap
Text File
|
1988-02-01
|
512b
|
13 lines
/*
** allocate and clear nelem elements of size elsize
*/
extern int malloc();
calloc(nelem, elsize) int nelem, elsize; {
int size;
char *calloc, *ptr;
ptr = calloc = malloc(size = nelem * elsize);
if(calloc) while(size--) *ptr++ = 0;
return calloc;
}