RecursiveSort::RecursiveSort(int myArray[], int first, int arraySize)
{
int smallest = first, j;
if (smallest < arraySize)
{
smallest = first;
for (j=first+1; j<arraySize; j++)
{
if (myArray[j] < myArray[smallest])
{
smallest = j;
}
}
swap(myArray[first], myArray[smallest]);
first++;
RecursiveSort::RecursiveSort(myArray, first, arraySize);
}
};
and in my main(); i will call RecursiveSort sort(myArray, 0, arraySize);
There is a stack overflow when arraySize > 4000, and the program crashes. Is it possible to call class destructors somewhere to prevent stack overflow? I have tried using "release" instead of "debug" (project properties > configuration manager > configuration pull-down menu). However this causes other issues when I try to integrate a "TimeStamp_Lib.lib" library which is used to measure how long the sort takes.
Any advice/suggestions would be greatly appreciated, thank you!