Has anyone ever got problems because of forgetting to initialize a global variable?
And should I always initialize a variable when I create it?
P.S. I am talking about C++. Are the global variables initialized with "zero" by default? Or it depends on the compiler?
In C++, if you declare a global or static primitive type (int, double, bool, etc) it is set to zero. If it's local (declared inside a function), its value is undefined unless initialized.