std::realloc
Da cppreference.com.
![]() | Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate. La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
Elemento definito nell'header <cstdlib> | ||
void*realloc(void*ptr, std::size_t new_size ); | ||
Rialloca quella determinata zona di memoria. Deve essere stato precedentemente attribuito dalla
malloc()
, calloc()
o realloc()
e non ancora liberato con free()
, in caso contrario, i risultati sono indefiniti.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 ridistribuzione viene eseguita da uno:
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)
espandendo l'area esistente puntata da
ptr
, se possibile. Il contenuto della zona rimangono invariate fino al minore delle dimensioni nuove e vecchie. Se l'area è espanso, il contenuto della nuova parte della matrice sono undefined. 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)
alloca un nuovo blocco di memoria di byte
new_size
dimensioni, la copia area di memoria con dimensioni pari al minore tra il nuovo e il vecchio dimensioni, e liberando il blocco vecchio.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.
Se la memoria non è sufficiente, il blocco di memoria vecchio non viene liberata e null-pointer viene restituito.
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.
Indice |
[modifica]Parametri
ptr | - | puntatore all'area di memoria da riassegnare 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 | - | nuova dimensione della 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. |
[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.
You can help to correct and verify the translation. Click here for instructions.
[modifica]Esempio
This section is incomplete Reason: no example |
[modifica]Vedi anche
C documentation for realloc |