I want to know why exactly static variables in C, C++ and Java are initialized by zero by default? And why this is not true for local variables?
Paragraph 8.5.6 of the C++ standard states that:
"Every object of static storage duration shall be zero-initialized at program startup"
(The standard also says that the initialization of local variables is undefined)
As to why, the standard doesn't say ;) One guess is that it's reasonably easy to implement without any additional downsides.