Why does my loop execute when left is 2 in my linked list reversal function in C++?
I’m trying to reverse a segment of a singly linked list in C++ using the following function. However, I’m seeing unexpected behavior when the value of left
is 2. Specifically, the first while
loop executes even though the condition should evaluate to false
.