Need help with the error C3867

I have created a class for performing sorting using the quick sort runtime function, but complier is giving an error "MyList::CompareNumbers: function call missing argument list; use &MyList::CompareNumbers to create a pointer to member"

When I am using qsort in main program body same as I used below, it is working correctly and not asking for any pointer reference or argument list.

Kindly tell me the issue, I am student.

Thanks in Advance

#include "MyList.h"
#include <iostream>

using namespace std;

MyList::MyList(int size)
{
_size = size;
_listofNumbers = new int[size];
}
MyList::~MyList()
{
if ( _listofNumbers != NULL )
delete[] _listofNumbers;
}
int MyList::CompareNumbers(const void * FirstNum, const void * SecondNum)
{
return (*(int*)FirstNum - *(int*)SecondNum);
}
void MyList::SortList()
{
qsort(_listofNumbers, _size, sizeof(int), CompareNumbers);
}
You're passing the return value of CompareNumbers into that qsort function but you don't actually pass any parameters into CompareNumbers.
The function you pass to qsort can't be a non-static member function.
Come on Peter, static should not be used on function defined at file scope.

Can you guys provide me a the correct version of this?
Either make CompareNumbers a static member function or make it a free function (not a member function).
Topic archived. No new replies allowed.