malloc - cppreference.com
Namespace
Varianti

malloc

Da cppreference.com.
< c‎ | memory

Elemento definito nell'header <stdlib.h>
void* malloc( 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.

[modifica] 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.

[modifica] 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.

[modifica] Vedi anche