◐ Shell
clean mode source ↗

std::malloc - cppreference.com

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.

Click here for the English version of this page

<metanoindex/>

<tbody> </tbody>

Elemento definito nell'header

<cstdlib>

void* malloc( std::size_t size );

Assegna size byte di memoria non inizializzata.

Original:

Allocates size bytes of uninitialized storage.

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.

Parametri

size -

numero di byte da allocare

Original:

number of bytes to allocate

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Valore di ritorno

Puntatore all'inizio della memoria appena allocata o un puntatore nullo in caso di errore si è verificato. Il puntatore deve essere rilasciata con free().

Original:

Pointer to the beginning of newly allocated memory or null pointer 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.

Note

Questa funzione non chiamare funzioni di costruzione o di inizializzare la memoria in alcun modo. Così metodo preferito di allocazione di memoria è espressione

new

.

Original:

This function does not call constructors or initialize memory in any way. Thus preferred method of memory allocation is

new

expression.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Esempio

Vedi anche

allocazione funzioni

Original:

allocation functions

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(funzione) [modifica]

ottiene stoccaggio non inizializzata

Original:

obtains uninitialized storage

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(funzione di modello) [modifica]

C documentation for malloc