[Solved] C/C++ the result of the uninitialized array


That is undefined behavior. There is no guarantee, if these zeros are there, that just accidentally is true.

The explanation is, that for some random reason at these places in memory a 0 was stored before it was reused for your purpose here. Since you allocate your arrays on the stack, these zeroes are probably from a prior function call and might be some padding. The compiler will do that as he pleases.

solved C/C++ the result of the uninitialized array