Skip to main content

Section 22.16 Sort Arrays

Activity 22.7.

Suppose you have declared two arrays:
int numbers[]={5, -1, 8, 4, 0, -10};
int sort[6];
What values should you place in your sort array so the following loop prints out the list of numbers, sorted from smallest to largest?
for (i=0; i<6; i++) {
  printf("%d, ", numbers[sort[i]]);
}
Record your answer below.