How do I initialize an array through a constructor? Here is the code for a class called Sort:
private:
double unpartitionedList[];
public:
Sort(double unpartitionedList[]);
Sort::Sort(double unpartitionedList[])
{
this->unpartitionedList = unpartitionedList;
}
I'd like to be able to pass an array to the constructor and have it stored in unpartitionedList[]. Like this: Sort(array[])
As the code is now, I get a compiler error in DevC++:
"[Error] incompatible types in assignment of 'double*' to 'double[0]'"
I've tried inserting reference (&) and dereference (*) operators where I thought they were needed, but unfortunately, my attempts were unsuccessful.
Any suggestions would be greatly appreciated.
std::arrayorstd::vector, though.