Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

C++ Programming/Code/Standard C Library/Functions/calloc

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

calloc #include <cstdlib> void *calloc( size_t num, size_t size); The function calloc() allocates a block of memory that can store an array of num cells, each with a size size. Every cell of the array is set to value zero. If the operation fails, calloc() returns "NULL". EXAMPLE: ptr = (float*)calloc(25, sizeof(float)); /* It would create an array of 25 cells, each one with a size of 4 bytes “(sizeof(float))”, all the cells initialized with value 0 */ Related topics free - malloc - realloc