5 /* void * calloc( size_t, size_t )
7 This file is part of the Public Domain C Library (PDCLib).
8 Permission is granted to use, modify, and / or redistribute at will.
16 void * calloc( size_t nmemb, size_t size )
18 void * rc = malloc( nmemb * size );
21 memset( rc, 0, nmemb * size );
29 #include <_PDCLIB_test.h>
35 TESTCASE( ( s = calloc( 3, 2 ) ) != NULL );
36 TESTCASE( s[0] == '\0' );
37 TESTCASE( s[5] == '\0' );
39 TESTCASE( ( s = calloc( 6, 1 ) ) != NULL );
40 TESTCASE( s[0] == '\0' );
41 TESTCASE( s[5] == '\0' );
43 TESTCASE( ( s = calloc( 1, 6 ) ) != NULL );
44 TESTCASE( s[0] == '\0' );
45 TESTCASE( s[5] == '\0' );