as an example, your heap would start at word 0. if your first call is myalloc(5), then you would start the header at word 1, your payload at word 2, and your footer at word 4 to meet alignment requirements. this is because the payload would have to start at an address divisible by 8, and take up two words, 5 bytes for the payload and 3 bytes of padding. so, your header would start at word 1 (address 4), the payload would start at word 2 (address 8), and your footer would start at word 4 (address 16). this would allow your next header to start at word 5 (address 20) and the next payload to start at word 6 (address 24).

Respuesta :

C has a set of predetermined programming rules because it is a structured language. One of them involves altering an array's size.

In C, a single big block of memory with the requested size is dynamically allocated using the "malloc" or "memory allocation" method. It returns a void pointer that can be cast into any other pointer type. Since it doesn't initialize memory during execution, each block has been originally initialized with the default garbage value.

malloc ptr = (cast-type*) (byte-size)

For instance:

(int*) malloc(100 * sizeof(int));

This statement will allocate 400 bytes of RAM because an int is 4 bytes in size. Additionally, the address of the first byte in the allocated memory is contained in the pointer ptr.

Learn more about memory here-

https://brainly.com/question/11103360

#SPJ4