Access Primitives

accessfirst(exlist, exav)

The access variable exav is made to point to the first node of the list exlist, irrespective of its previous contents.

LL-AP1

accessnext(exlist, exav)

The access variable exav is changed to point to the successor of the node it pointed to originally. (Note that this assumes that it pointed to a node originally).

LL-AP2

What happens if we:

a)       accessfirst(exlist, exav) and the list is empty?

b)       accessnext(exlist, exav) when exav points to the last node?

In both cases exav becomes invalid. We could define a test function, eg: validlist(exlist, exav) which will return the value false if the list is empty. This allows us to test for an empty list. We will make use of a function like this in algorithms later.

Next: Traversal