Espaços nominais
Variantes
Acções

std::calloc

Da cppreference.com
< cpp‎ | memory‎ | c

 
 
Biblioteca de utilitários
Digite apoio (basic types, RTTI, type traits)
Gerenciamento de memória dinâmica
De tratamento de erros
Utilidades do programa
Variadic funções
Data e hora
Objetos de função
(C++11)
Os operadores relacionais
Original:
Relational operators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
rel_ops::operator!=
rel_ops::operator>
rel_ops::operator<=
rel_ops::operator>=
Pares e tuplas
Original:
Pairs and tuples
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
(C++11)
Troque, avançar e avançar
Original:
Swap, forward and move
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
(C++11)
(C++11)
(C++11)
 
Gerenciamento de memória dinâmica
Gerenciamento de memória de baixo nível
Alocadores
Original:
Allocators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Uninitialized armazenamento
Original:
Uninitialized storage
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Ponteiros inteligentes
Original:
Smart pointers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
(C++11)
(C++11)
(C++11)
(obsoleta)
(C++11)
Apoio a coleta de lixo
Original:
Garbage collection support
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Diversos
Original:
Miscellaneous
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
(C++11)
(C++11)
C Library
Original:
C Library
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
calloc
 
Definido no cabeçalho <cstdlib>
void* calloc(std::size_t num, std::size_t size );
Aloca memória para uma matriz de objetos de numsize tamanho e zero-inicializa-lo.
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.
Se a alocação for bem sucedida, retorna um ponteiro para o byte mais baixo (primeiro) no bloco de memória alocada que é adequadamente alinhado para qualquer tipo de objeto.
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, o comportamento é implementação definida (ponteiro nulo pode ser devolvida, ou algum ponteiro não nulo pode ser retornado que não pode ser utilizado para aceder a armazenamento)
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.

Índice

[editar]Parâmetros

num -
número de objetos
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 -
tamanho de cada objeto
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.

[editar]Valor de retorno

Ponteiro para o início da memória recém-alocado ou NULL se o erro ocorreu. O ponteiro deve ser desalocado com 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.

[editar]Notas

Devido aos requisitos de alinhamento, o número de bytes atribuídos não é necessariamente igual a 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.

[editar]Exemplo

[editar]Veja também

Documentação C para calloc
close