Malloc
Malloc is a standard library function in the C programming language used to allocate a block of memory from the heap. It is declared as void* malloc(size_t size) and returns a pointer to a block of at least size bytes, or NULL on failure. The contents of the allocated block are indeterminate.
The memory is not initialized; the values are undefined. If zero-initialized storage is required, use calloc
The allocated memory must be released with free when it is no longer needed to avoid memory
Implementation details vary: malloc allocates from the process heap using the allocator supplied by the C standard
The exact behavior, performance characteristics, and alignment guarantees depend on the C library's malloc implementation. Modern
Common related functions are calloc, realloc, and free. See also memory management in C.