My program crashes when the show function is called for the second time. I'm pretty sure its an issue of the NULL pointer being derefrenced. The problem is, I am not sure of a way around this without losing the first element of the array.
I may have phrased that wrong, but it is in the while loop of Queue::show(). I know exactly where it is happening, and i can avoid it by saying while(walker != tail) but it doesn't display the first element in the queue until another is added into it, then it doesn't display the second.
at some point next is pointing to NULL, and the pointer operator is dereferencing it. That's what im trying to avoid without the program crashing.
Instead of while(walker != tail), try while(walker != nullptr).
If the que is empty walker will instantly be null because head is null.
If there is/are item(s) in the que, walker will become null after the data of the last item has been output and walker was set to its next.