Original Post
Hello everyone! I always thought that the default value for a bool was false. But it turned out i discovered that it gets true sometimes, and it depends on the machine it is running.
#include <cstdio>
int main()
{
bool l_default_value;
if(l_default_value)
printf("default value for bool is true\n");
else
printf("default value for bool is false\n");
return 0;
}
Is there a default value for a bool in C++? Why this happens? TIA.