If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Bubble Sort Issue

I am trying to implement a bubble sort algorithm in a linked list. The code runs to completion, but when I try to print it, I get the following error: Unhandled exception at 0x01222833 in LinkedList.exe: 0xC0000005: Access violation reading location 0xfeeefef6. I have included the relevant code below.

Re: Bubble Sort Issue

Originally Posted by jduhamel

I am trying to implement a bubble sort algorithm in a linked list. The code runs to completion, but when I try to print it, I get the following error: Unhandled exception at 0x01222833 in LinkedList.exe: 0xC0000005: Access violation reading location 0xfeeefef6. I have included the relevant code below.

Did you use the debugger?

I suggest you do this, since debugging is part of the process of learning how to program. Once you use the debugger, what did you notice that isn't working correctly?

Secondly, please use code tags when posting code. The code you posted is unformatted and almost unreadable.

Third, why are you creating new nodes just to swap data? For example this is not neccessary: