If you run the program with your debugger the debugger should be able to tell you exactly where it detected the problem and you should also be able to view the variables at the time of the crash.
The program has no errors at all but it explodes when I run it. Any Ideas? I am compiling with the GNU GCC Compiler on Code::Blocks with the GDB Debugger. I have never had any issues like this ever before.
It looks like you're accessing the array out of bounds.
Did you run the program with your debugger? The debugger is an essential tool that you need to learn to use if you really want to be a programmer. Set a break point before the line in question and then single step through the problem section watching your variables as you step.
> temp already has a starting value for comparison.
No, it doesn't.
`temp' is uninitialized.
> It's just a sorting Algorithm.
No, it isn't.
It is a maximum algorithm.
> You use the variable index outside the for loop,
Limit the scope of your variables.
`index' is only used to traverse the array, it should be limited to the loop for(int index=0; index<5; ++index)