Difference between revisions of "cpp/memory/c/malloc"
From cppreference.com
m (Text replace - "<!-- ======== --> " to "") |
m (Wrong title.) |
||
Line 1: | Line 1: | ||
− | {{cpp/title| | + | {{cpp/title|malloc}} |
{{cpp/memory/c/sidebar}} | {{cpp/memory/c/sidebar}} | ||
{{ddcl | header=cstdlib | | {{ddcl | header=cstdlib | |
Revision as of 17:38, 13 August 2011
Defined in header <cstdlib>
|
||
void *malloc( size_t size ); |
||
Allocates an area of memory.
Parameters
size | - | number of bytes to allocate |
Return value
pointer to the beginning of newly allocated memory or Template:cpp if error has occurred. The pointer must be deallocated with free()
.
Notes
This function does not call constructors or initialize the memory in any way. Thus preferred method of memory allocation is new expression.