So, I found this bubble sort code somewhere on here an figured I'd give it a spin, but whenever I run it, the highest number(whatever it may be) is converted to -858993460. However many numbers I have or how high or low the number is, it's always this negative number. I was wondering if anyone had any idea why this is happening.
I noticed this happening in some other code I've done and I just sort of dismissed it.
Your loops are switched, because when x = 2, aray[x+1] = aray[3], which doesn't have any legal value or address since the array has elements only aray[0], aray[1], aray[2].
Wow, that fixed it. I don't completely understand how, but it worked.
Thank you (:
EDIT: Woah, actually ,I take that back. I somehow managed to screw it up more. Now whatever I put in as my first number, replaces my last number. The middle number is untouched, but the first always replaces the last.
EDIT 2: Oh god, I'm an idiot. I just noticed a typo that was causing this. Sorry! Thanks for the help.