Namespace
Varianti

calloc

Da cppreference.com.
< c‎ | memory

Elemento definito nell'header <stdlib.h>
void* calloc( size_t num, size_t size );
Alloca la memoria per un array di oggetti di num size dimensioni ed è zero-inizializza.
Original:
Allocates memory for an array of num objects of size size and zero-initializes it.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
In caso di assegnazione ha esito positivo, restituisce un puntatore al più basso del (primo) byte nel blocco di memoria allocata che sia adeguatamente allineato per qualsiasi tipo di oggetto.
Original:
If allocation succeeds, returns a pointer to the lowest (first) byte in the allocated memory block that is suitably aligned for any object type.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Se size è zero, il comportamento è definito di attuazione (puntatore nullo possono essere restituiti, o qualche non-puntatore nullo può essere restituito, che non può essere utilizzato per accedere allo storage)
Original:
If size is zero, the behavior is implementation defined (null pointer may be returned, or some non-null pointer may be returned that may not be used to access storage)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Indice

[modifica] Parametri

num -
numero di oggetti
Original:
number of objects
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
size -
dimensione di ciascun oggetto
Original:
size of each object
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[modifica] Valore di ritorno

Puntatore all'inizio della memoria appena allocata o NULL in caso di errore si è verificato. Il puntatore deve essere rilasciata con free().
Original:
Pointer to the beginning of newly allocated memory or NULL if error has occurred. The pointer must be deallocated with free().
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[modifica] Note

A causa dei requisiti di allineamento, il numero di byte allocati non è necessariamente uguale al num*size.
Original:
Due to the alignment requirements, the number of allocated bytes is not necessarily equal to num*size.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[modifica] Vedi anche