For Some reason when i'm trying to run this programm, it stops working. I can understand there's something like Stack Overflow, But Seriously how can i run this code? is there any possible way?
#include <iostream>
#include <ctime>
#include <cstdlib>
#include <conio.h>
using namespace std;
#define N 30000
int getUniqueNumber(int *szTable,int szCounter);
bool checkDuplicate(int *szTable,int szCounter,int szDupl);
class Sort {
private:
public:
int szTable[N];
/*Sort() {
int i;
for (i=0;i<N;i++) {
this->szTable[i]=getUniqueNumber(this->szTable,i);
}
}*/
// int bubbleSort();
// void quickSort();
// int straightSelSort();
// int straightInsSort();
};
int main(int argc, char** argv) {
Sort Tables[20];
return 0;
}
Sort Tables[20];
most probably exceeds your available stack size with N = 30000
.
You may try to allocate an appropriate vector from the heap instead:
std::vector<Sort> Tables(20);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.