Question: Why is this printing an infinite loop? template void LinkedList ::print() { int index = 0; Node* it = head; while (it != NULL) {
Why is this printing an infinite loop?
template
void LinkedList
{
int index = 0;
Node* it = head;
while (it != NULL)
{
std::cout << "{" << index << ":" << it->val << "}";
if (it->next != NULL)
{
std::cout << ", ";
}
it = it->next;
}
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
