Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To initialize a boolean array in C++, you can use either of the following methods:

  1. Initialize the array with default values:

bool arr[5]; // Creates an array of size 5 with default values (false)

  1. Initialize the array with specific values:

bool arr[5] = {true, false, true, true, false}; // Creates an array of size 5 with specified values

Note: It is important to ensure that the size of the array matches the number of values being initialized.