Code:
// POINT_BUBSORT.CPP
// Bubble sort function. Sorts an array of ints in descending order.
template<class element>
void pointerBubbleSort(apvector <element> &array, int n)
{
  apvector <element*> pointer(n);
  int i, j, flag = 1;
  int *temp;

  for (i = 0; i < n; i++)
	  pointer[i] = &array[i];

  for(i = 1; (i <= n) && flag; i++)
   {
     flag = 0;
     for(j = 0; j < (n - i); j++)
	{
	  if (pointer[j + 1] > pointer[j])
	   {
	     temp = pointer[j + 1];
	     pointer[j + 1] = pointer[j];
	     pointer[j] = temp;
	     flag = 1;
	   }
	}
    }
}
There's my sort algorithm. Please don't tell me whether its a good one or not, I'm trying out some ideas and need to find out for myself.

I'm trying to sort using pointers to characters in a vector. For some reason it is always going out of bounds with a negative number, even if I initialize them to death. Apvector has bounds checking, and it keeps closing the program.