You are not initializing the array, the printed values are garbage stored in the memory where your declared array now lives, since you don't initialize it we can't know what's there.
Note that the size of a bool
is implementation defined so we can't really guess a range of values for the aforementioned undefined behavior when printing unitialized members of the array.
The usual behavior we see is the compiler using the most efficient available type which usually means an unsigned 1 byte/8 bit wide type. In this situation you could expect the uninitialized values to be in the range of 0 to 255.
To initialize all the values in the array you could do this:
bool arr[5][5]{};
With this value initialization the array would be zero initialized and your program would output:
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
You can use boolalpha to print actually true
or false
:
Example:
https://godbolt.org/z/xvh67jWWK