bool being initialized to true?

It was my understanding that I could create a bool variable and then pass it as a reference parameter like so:

1
2
3
4
List myList;
bool x;

myList.sortedInsert(1,x); 


But why is bool being initialized to true in this case?
All basic types (including bools) are not initialized to anything unless you specifically initialize them with a value.

Your bool isn't necessarily being initialized with true, it's just not being initialized, which means it will contain whatever happened to be left over in the memory it was allocated to. Might be true, or it might be false. It will differ.
Topic archived. No new replies allowed.