#include <iostream>
using namespace std;
int main() {
int var; // default initialization var = 0 Why?
cout << var << endl;
return 0;
}
If i understand default initiaization right, int variable must be indeterminate value.
The effects of default initialization are: 1) if T is a non-POD (until C++11) class type, the constructors are considered and subjected to overload resolution against the empty argument list. The constructor selected (which is one of the default constructors) is called to provide the initial value for the new object; 2) if T is an array type, every element of the array is default-initialized; 3) otherwise, nothing is done: the objects with automatic storage duration (and their subobjects) are initialized to indeterminate values.
So, why int var equal 0 in that case?