Having issues with g++ compiler from Code Blocks

closed account (4ET0pfjN)
Hi, I "installed" g++ compiler by using Code Blocks, which is an IDE but it was simple as all I had to do was including the bin directory containing the included g++, gcc, php compilers etc in path in Environmental Variables. I think it's limitation of the included g++ compiler b/c I want to carry out timing sorting algorithms efficiencies and I can't even declare an array for my bubble sort array to be 1000000 items. When I run the code, it crashes w/ just these lines of code:

1
2
3
4
5
6
7
8
int main()
{
 long bbList[1000000];//size of bubble sort list I want to use eventually
 int bbSize = sizeof(bbList)/sizeof(int);
 cout << bbSize << endl;
 int value = 1000000;
 return 0;
}


Does anyone know how to increase limit or is there another way to install newer g++ compiler?
Questions like this seem pretty common recently.
Use dynamic allocation, or a vector:
1
2
3
4
5
int main()
{
int *bbList = new int [1000000];
std::vector<int> bbList(1000000);
}
Last edited on
closed account (4ET0pfjN)
Thanks for that, I forgot about dynamic allocation...
Topic archived. No new replies allowed.