Allocated storage duration begins when a dynamic allocation function creates an object and ends when free or realloc destroys it. Without either call, it lasts until program execution ends. section 13.2
Track allocated objects with these rules:
- Recognize malloc, calloc, realloc, and aligned_alloc as operations that can create allocated objects. section 13.2
- End the duration with free or a realloc operation that destroys the object; otherwise, rely on program termination. section 13.2
- Initialize allocated objects explicitly; use calloc when setting every bit to zero is a valid initialization. section 13.4
- Encapsulate recurring initialization in a function for each data type. section 13.4
Allocating and initializing a value
rat const* myRat = rat_init(malloc(sizeof(rat)), 13, 7); The malloc call creates storage for a rat object; rat_init then establishes its value explicitly. section 13.4
rat const* myRat = rat_init(malloc(sizeof(rat)), 13, 7);
Inspect the compact allocation-and-initialization expression for a rat object. section 13.4

