There is no default value initialization guarantee of any kind in C.
I don't know where you learned the default value of booleans is false but I strongly question that information and disagree with it. Yes some compilers will do that for you, and yes in debug mode even more will; but that is not reliable at all. You should always initialize all your variables before using them. You will receive compiler warnings if you do not, and you will experience a world of pain and hurt in the form of non-deterministic behavior (in layman's terms inconsistent behavior) causing sporadic failures and causing latent bugs to be missed and will make your life a pain.
Non-Determinism is the cause of many of the hardest bugs to figure out and debug because it ruins reproducibility. Things don't happen consistently or reliably; it might work 99 times out of 100, but that 1 time it doesnt work right you are screwed. And the fact that it could be that rare ( or rarer) makes it harder to find, and hard to reproduce.
In layman's terms, non-determinism means that the same inputs don't always lead to the same outputs, etc. In most math you have or will encounter things are deterministic, the same input always has the same output. (Yes there are parts of math/physics that deal with this not being true but if you know about them then you don't need this explanation (: ) Example: two plus two always equals four, area of a circle is two time pi times radius, for some function f(x) = y, for all values of x, f(x) = f(x), etc.
Non-determinism would be like if you had a function in math f(x) = 3x + 2 + q()
where q()
returns 0
99% of the time and a random number the other 2%. As a result sometimes, and randomly, f(x)
can just return an unexpected value. Clearly it should be evident that if you had a composition of functions like: (assume a
, b
, c
, d
, e
are all functions. )
result = a(b(f(x))) + c( d(f(x)), e(f(x)) )
You are in for a world of pain figuring out what's wrong when it doesn't give you the proper result.
That's basically what you have with programming.
I hope that helps not just answer the question, but explain some deeper background about it and Computer Science / Programming in general. Best of luck with your adventures in coding.