For deleting a node which holds obj and is found in the middle of a linked list I did:
traverser -> next() -> retrieve()) == obj
where
Single_node<Type>* traverser = head();initially.retrieve()returns the obj stores inside a Single_nodenext()returns the next pointer in a Single_node
This is giving a bad access error on the retrieve()
I don’t understand why..?
Are we not allowed to do ” xxxxx -> bbbbb -> zzzzz ” sort of thing?
You can do certainly do it, except when you are pointing at the last element of the list: in this case,
next()would returnNULL, and you would see bad access as the result.