@CoddingHead, in C variables are automatically initialized to zero at program start-up, but only if they have
static storage duration and don't have an explicit initializer. The following kinds of variables do
not have static storage duration (and hence are not automatically initialized to zero):
- Automatic variables (defined within a block, but without static keyword).
- Register variables (defined with register keyword).
- Dynamic variables (created with malloc or calloc).
I believe the rules are similar in C++. I suppose variables created with
new keyword are perhaps maybe like dynamic variables. I'm not a C++ expert.