|
| archer86 (15) | |||
Can anyone shed some light as to why this small sort program doesn't work properly?
The output is: AFTER SORT: 0 1 3 4 5 6 7 2 9 8 Thanks in advance. C:\Dev-Cpp> | |||
| CamelCase (10) | |
| I just ran it on my system compiled with code::blocks, it ran fine output is 1 2 3 4 5 6 7 8 9 10... | |
| dgirdhar (6) | |
| I also tried, it is working fine on my machine too. | |
| Grey Wolf (1407) | |||
Just looking over the code, Line 17, while(scan<=upper-lower){ would allow scan to go to a value of 9, you then look at slot[scan+1], which is out of bounds for slot and would result in unpredicable behavour.Try this:
| |||
Last edited on | |||
This topic is archived - New replies not allowed.
