std::calloc
De cppreference.com
![]() | This page has been machine-translated from the English version of the wiki using Google Translate. The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
Déclaré dans l'en-tête <cstdlib> | ||
void* calloc(std::size_t num, std::size_t size ); | ||
Alloue de la mémoire pour un tableau d'objets
num
de size
taille et l'initialise à zéro . 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.
You can help to correct and verify the translation. Click here for instructions.
Si l'allocation réussit, renvoie un pointeur vers le plus bas (premier) octet dans le bloc de mémoire alloué qui est correctement alignée pour n'importe quel type d'objet .
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.
You can help to correct and verify the translation. Click here for instructions.
Si
size
est égal à zéro, le comportement est défini par l'implémentation (pointeur NULL peut être retourné, ou quelque pointeur non NULL peuvent être retournés qui ne peut pas être utilisé pour accéder au stockage)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.
You can help to correct and verify the translation. Click here for instructions.
Sommaire |
[modifier]Paramètres
num | - | nombre d'objets 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 | - | taille de chaque objet 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. |
[modifier]Retourne la valeur
Pointeur au début de la mémoire nouvellement allouée ou si NULL erreur s'est produite. Le pointeur doit être libérée avec
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.
You can help to correct and verify the translation. Click here for instructions.
[modifier]Notes
En raison des exigences d'alignement, le nombre d'octets alloués n'est pas nécessairement égal à
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.
You can help to correct and verify the translation. Click here for instructions.
[modifier]Exemple
This section is incomplete Reason: no example |
[modifier]Voir aussi
C documentation for calloc |