Im getting the following error while running a c++ program with xcode. The program works fine except for the custom destructor to release the dynamically allocated memory in the object "workforce." The error does not occur when running the same code with Dev c++. I prefer xcode as an IDE. Maybe there is a compiler setting that needs to be tweaked?
A4Q1(94887) malloc: * error for object 0x100100a38: pointer being freed was not allocated
workforce::workforce(int n) // set size = n and allocate an array of employees
{
size = n;
list = new employee [n]; //allocate sufficient memory for n employees
}
// big 3 prototypes here
workforce::~workforce(void)
{
delete [] list;
//cout << "Destroying workforce"<<endl;
}