Probably stack overflow. Create the array dynamically, it will work (because it will be created on the heap). Or, use std::vector< std::vector< char > >
, instead. ( be very careful, if you decide to use std::vector< bool >
.. unless you don't know what exactly you're doing (it's not normal STL container, containing just bools), use it with char ).
Using std::vector< std::vector< char > >
will let you use the object as normal two-dimensional array.
EDIT:
std::vector< bool >: "This specialization is provided to optimize for space allocation: In this template specialization, each element occupies only one bit (which is eight times less than the smallest type in C++: char).
The references to elements of a bool vector returned by the vector members are not references to bool objects, but a special member type which is a reference to a single bit, defined inside the vector class specialization as". CPlusPlus