b->display();
yields undefined behavior. That means, whatever your computer does at that moment is good enough.
The question of where b->a
is stored makes no sense, because accessing b->a
yields undefined behavior.
In some cases, C++ is not obliged to tell you that you screwed it up. Dereferencing a pointer to uninitialized memory is such a case.