class test {
public:
test() {};
bool active;
};
int main()
{
test a;
cout << a.active << endl;
return 0;
}
The following code always prints 204
. I tested many other types, and got some very strange results. An int prints -858993460
, a double prints -9.25596e+61
and the list goes on.
Why doesn't C++ throw an error such as uninitialized class member 'active' used
instead of assigning what seems to be an arbitrary value?