Listing 1 An attempt to use qsort in C++

#include <stdlib. h>

int compare_function(const void * a, const void * b);

class A
   {
private:
   struct DataType
        {
        double x,y;
        } * data;
   int size;
public:
   A();
   A(int n, double *x, double *y);
   void sort();
   };

void A::sort()
   {
   qsort (data, size, sizeof(DataType), compare_function);
   }

int compare_function(const void * a, const void * b)
   {
   const DataType *first = (DataType*) a;
   const DataType *second = (DataType*) b;
//  Ought these declaration be as follows ?
//  const A::DataType *first = (A::DataType*) a;
//  const A::DataType *second = (A::DataType*) b;
   if (first->x > second->x)
     return 1;
   else if (first->x < second->x)
     return -1;
   else
     return 0;
   }
/* End of File */