EXC_BAD_ACCESS?
I'm writing a number ordering program, and one of my functions is returning EXC_BAD_ACCESS in a place it never has before.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
void ordernums(float array[101])
{
for (int n = 0;n<100;n++) {
for (int i = 0;; i++) {
float temp;
if (array[i] > array[i+1]) {
temp = array[i];
array[i] = array[i+1];
array[i+1] = temp;
}
}
}
}
|
The message is at line 11. Whats wrong with it?
And what value is i? When does the inner loop end?
Topic archived. No new replies allowed.