What is the linked list?
It is a data structure consisting of nodes:
- Each node contains an element and a link to the next element.
- The address of the first node defines the linked list.
- The last node's next element address is set to 0. By convention no element can reside at this address.
For example, here is a hardcoded linked list of integers 1, 2 and 3 in assembly:
elem1:
dq 1
dq elem2 ; the address of the second element
elem3: ; The elements can be in whatever order you like,
; because they all hold addresses of their successors anyway
dq 3
dq 0 ; no successor for the last element
elem2:
dq 2
dq elem3