std::malloc

From Cppreference

< cpp | memory | c
Jump to: navigation, search
Defined in header <cstdlib>

void *malloc( size_t size );

Allocates an area of memory.

[edit] Parameters

size - number of bytes to allocate

[edit] Return value

pointer to the beginning of newly allocated memory or NULL if error has occurred. The pointer must be deallocated with free().

[edit] Notes

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