A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://en.wikibooks.org/wiki/C++_Programming/Code/Standard_C_Library/Functions/calloc below:

C++ Programming/Code/Standard C Library/Functions/calloc - Wikibooks, open books for an open world

From Wikibooks, open books for an open world

Syntax
#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

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4