I've confusion with static member variable in c++ class.
Please have a look on following code.
static int i;
int test::i = 0;
test *t = new test;
test::i = 100;
cout << "test::i = " << test::i << endl;
t->j = 10.67;
cout << "t->j = " << t->j << endl;
t = NULL;
t->i = 200;
cout << "t->i = " << t->i << endl;
In above code, i've delete class pointer, t and assigned it to NULL;
and on that i'm accessing static member variable (t->i). It is working fine.
My question is why it should not crash, as i'm accessing member variable on null.
Thanks & regards,