Q:

Dynamic Array in order printing

I need to print an array of in order of largest to smallest.  For simplicity, we'll say that it is an array of ints.  
The only way I can think to do it is loop through the array, find the largest element, print it and set a corresponding boolean flag so it doesn't get printed twice.  Is there a better way to go about this?
int *array;

// Fill array, malloc, all that good stuff

int i, j, max = 0, max_index = 0;
int isPrinted[ARRAY_SIZE] = {0};

for (i = 0; i < ARRAY_SIZE; i++) {
  for (j = 0; j < ARRAY_SIZE; j++) {
    if (isPrinted[j] == 0 && array[j] > max) {
      max = array[j];
      max_index = j;
    }  
  }
  isPrinted[max_index] = 1;
  printf("%d", max);
  max = 0;
}

A:

Yes..sort the array before printing and then print it. 
If you can't modify the original array, copy the elements to another inserting them in the correct order and print the second one.

