What’s the difference between creating an object with a pointer and without a pointer?
MyObject objectName();
MyObject* objectName = new MyObject();
Without a pointer, does the object get destroyed automatically when the function call is over? That is, is it not in dynamic memory and just treated as a primitive variable?