I have a problem. The statement says that the results at a contest are read from standard input and I have to print to the screen the final standings in decreasing order by the number of solved problems. Here is my code.
#include <cstdio>
#include <vector>
#include <cstdlib>
using namespace std;
struct results
{
  unsigned int id; //id of the team
  unsigned int m; //number of solved problems
};
int comparare(const void * i, const void * j) //compare function for qsort()
{
  return -( *(unsigned int*)i - *(unsigned int*)j );
}
int main()
{
  unsigned int n;
  vector<results> standings; //initializing an array of structs
  scanf("%u", &n); //the size of the vector
  for(unsigned int i=0; i<n; ++i)
  {
    scanf("%u%u", &standings[i].id, &standings[i].m); //reading the elements
    standings.push_back(results());
  }
  qsort(standings, n, sizeof(results), comparare); //sorting the array
  for(unsigned int i=0; i<n; ++i)
    printf("%u %u\n", standings[i].id, standings[i].m); //print the sorted array
  return 0;
}
When I want to compile the code, the compiler finds the error
cannot convert 'std::vector' to 'void*' for argument '1' to 'void qsort(void*, size_t, size_t, __compar_fn_t)'
in the line qsort(standings, n, sizeof(results), comparare);
What I have to do to repair this?
 
     
     
    