LinkedListPointer problem?


#1

I'm trying to use LinkedListPointer and specifically getLast()

 

It always seems to return null;

 

I'm looking at

 


while (l->item != nullptr) l = &(l->item->nextListItem);

shoud that be...

 


while (l->item != nullptr && l->item->nextListItem !=nullptr)  

l = &(l->item->nextListItem);

#2

getLast() can't return null - it returns a reference not a pointer!


#3

Ok tnx, yea, I see what I was assuming.  (I was assuming the last "item" would be returned)