#include <iostream>
using namespace std;
class Test
{
public:
int x;
Test() { x = 5;}
};
int main()
{
Test *t;
cout << t->x;
}
It should print "5" but instead, it prints "1528349827". Test *t should initialize x by 5. and t->x should print 5. But it gives the above number. Can someone please explaint to me what's happening.
Aucun commentaire:
Enregistrer un commentaire