Answer
malloc allocates a requested number of bytes and returns a suitably aligned pointer to the allocated space. • The allocated bytes have indeterminate values. • It returns a null pointer when allocation fails. • The returned allocation must be released with free when no longer needed.
💡 C Example
int *values = malloc(5 * sizeof *values);
if (values == NULL) {
return 1;
}
free(values);
⚡ Quick Revision
malloc allocates uninitialized storage or returns a null pointer.