#include <iostream>
using namespace std;
class A
{
    public:
        int x;
};
int main()
{
    A a = A();
    cout<<a.x<<endl;
}
For this code I am getting the output as 0 but when i create the object as A a; and then print a.x, I get garbage value. Why is this so?
 
    