I am trying to initialize an array of bools like so:
bool FcpNumberIsOk[MAX_FCPS]={true};
but when I debug it, I only see the first element of the array initialized, the others are false. How can that be so? I am using Qt on ubuntu 10 and the initialization is done on a local array inside a method.
Ok thanks for your answers.
Because that’s the way array initialization works in C++. If you don’t explicitly give a value for each element, that element defaults to zero (or, here, false)
Note that
Will set all values to false or have them set randomly, depending on where this is defined.