home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_100 / 163_01 / calloc.c < prev    next >
Text File  |  1988-01-31  |  512b  |  13 lines

  1. /*
  2. ** allocate and clear nelem elements of size elsize
  3. */
  4. extern int malloc();
  5.  
  6. calloc(nelem, elsize) int nelem, elsize; {
  7.   int size;
  8.   char *calloc, *ptr;
  9.   ptr = calloc = malloc(size = nelem * elsize);
  10.   if(calloc) while(size--) *ptr++ = 0;
  11.   return calloc;
  12.   }
  13.