8 bytes (4 bytes for the integer, 4 bytes for the address)
Dynamic memory can be used for a node. Here is a program that creates the two-node linked list of the picture:
First, 8 bytes are dynamically allocated for the first node.
The address of the node is saved in $s1
.
The data, "1", is copied into the first four bytes of the
node at displacement 0
off of $s1
.
The process is repeated for the second node, except that
its address is saved in $s2
.
To complete the structure, the first node is made to point to the second node. This is what the green arrow between the nodes shows. Also, a null should be put in the pointer field of the last node. But the code is not complete.
Fill in the blanks.