VEngineer
asked on
bool default initialize
Is standard type bool initialized to false by default? Or is it undefined until a value {true | false} is assigned?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Actually that has nothing to do with arrays. The POD (Plain Old Data, like the built in types, but also classes and structures without constructors and virtual functions and with no members with constructors and virtual functions) are always initialized to 0 when global. This is true regardless of whether or not they are in an array. When local or dynamically allocated they will be set to random values.
ASKER
Arrays defined in the global scope with fundamental base types have their array elements set to zero unless there is explicit initialization.
Arrays defined in a local scope with fundamental base types have their array elements uninitialized unless there is explicit initialization.