Code:
void SortAscending()
{
for(x = 0; x < 10; x++)
if (iArray[x] >= iArray[x]+x)
printf("%d\n",iArray[x]);
else
printf("%d\n",iArray[x]+x);
}
Make your array size 10 (or whatever number), and then use x < 10.
Here you made your array size only 9, so in C with zero based arrays,
your x variable will run beyond the top of the array on the last loop.
You need two nested loops to sort a 1D array. something like this:
for(i = 0; i < 9-1; i++) {
for(j = i+1; j < 9; j++) {
if(a[i] > a[j]) { //change to < for descending sort, and no = is needed
temp = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
Change the 9 to 10 if you change the array size to 10, in for loops.
That will get your sorts going, although this is a slow sorter on large arrays.