my first question here. I am trying to create a bool array of 17770 x 10000. This simple program creates the array (for further use) and states its size. The problem is that when the array grows somewhat above 1MB in size, the program doesn't execute correctly and returns "Process returned -1073741571 (0xC00000FD)" instead of the size. From what I understand it is caused by not enough assigned memory. My coding skills are very basic, so when I tried using pointers and "new", or searched for solutions online, I wasn't able to make it compile correctly afterwards. I am using Code::blocks 16.01 with GNU GCC on Windows 10.
#include <string>
#include <fstream>
#include <sstream>
#include <iostream>
#include <conio.h>
int main()
{
using namespace std;
bool binarna;
int x = 1;
int y = 2;
int conversion = 0;
cout << " enter map_main_grid dimesions (x y): \n" << endl;
cout << " ";
cin >> x >> y;
cout << endl;
bool map_main_grid [ x ] [ y ] = { 0 };
cout << " Bool array size is:\n"
<< " map_main_grid: ";
if ( sizeof map_main_grid >= 1000 )
{
conversion = sizeof map_main_grid / 1000;
cout << conversion << " kB \n ";
}
else
cout << sizeof map_main_grid << " B \n";
cout << "\n exact size in kB is rounded to closest integer";
getch();
return 0;
}
User contributions licensed under CC BY-SA 3.0