GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||
GeezerVison is showing cplusplus.com — malloc Reference
<cstdlib> (stdlib.h)
function
<cstdlib>
mallocvoid* malloc (size_t size); Allocate memory block
The content of the newly allocated block of memory is not initialized, remaining with indeterminate values. If size is zero, the return value depends on the particular library implementation (it may or may not be a null pointer), but the returned pointer shall not be dereferenced. Parameters
Return ValueOn success, a pointer to the memory block allocated by the function.The type of this pointer is always void*, which can be cast to the desired type of data pointer in order to be dereferenceable.If the function failed to allocate the requested block of memory, a null pointer is returned. Example
This program generates a string of the length specified by the user and fills it with alphabetic characters. The possible length of this string is only limited by the amount of memory available to malloc Data racesOnly the storage referenced by the returned pointer is modified. No other storage locations are accessed by the call.If the function reuses the same unit of storage released by a deallocation function (such as free or realloc), the functions are synchronized in such a way that the deallocation happens entirely before the next allocation. Exceptions (C++)No-throw guarantee: this function never throws exceptions.See also
Home page | Privacy policy
© cplusplus.com, 2000-2026 - All rights reserved - v3.3.4s Spotted an error? contact us | ||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |