std::realloc
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 *realloc( void *ptr, std::size_t new_size ); |
||
Redistribue la zone de mémoire donnée. Il doit être préalablement alloué par
malloc()
, calloc()
ou realloc()
et non encore libérés avec free()
, sinon, le résultat est indéfini .Original:
Reallocates the given area of memory. It must be previously allocated by
malloc()
, calloc()
or realloc()
and not yet freed with free()
, otherwise, the results are undefined.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.
La réattribution est effectuée soit par:
Original:
The reallocation is done by either:
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.
a)
extension de la zone existante désignée par
ptr
, si possible. Le contenu de la zone restent inchangés jusqu'à concurrence du moindre des tailles anciens et nouveaux. Si la zone est étendue, le contenu de la nouvelle partie du tableau ne sont pas définis . Original:
expanding the existing area pointed to by
ptr
, if possible. The contents of the area remain unchanged up to the lesser of the new and old sizes. If the area is expanded, the contents of the new part of the array are undefined. 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.
b)
attribution d'un nouveau bloc de mémoire d'octets
new_size
taille, la copie zone de mémoire à taille égale au moindre de la nouvelle et l'ancienne taille, et la libération de l'ancien bloc .Original:
allocating a new memory block of size
new_size
bytes, copying memory area with size equal the lesser of the new and the old sizes, and freeing the old block.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.
S'il n'y a pas assez de mémoire, le bloc de mémoire ancienne n'est pas libéré et pointeur NULL est retourné .
Original:
If there is not enough memory, the old memory block is not freed and null-pointer is returned.
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
ptr | - | pointeur sur la zone mémoire pour être réaffecté
Original: pointer to the memory area to be reallocated The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
new_size | - | nouvelle taille de la matrice
Original: new size of the array 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] Exemple
This section is incomplete Reason: no example |
[modifier] Voir aussi
C documentation for realloc
|