# Making an object without a pointer

**URL:** <https://forum.kirupa.com/t/making-an-object-without-a-pointer/284216>\
**Category:** Uncategorized\
**Created:** [March 16, 2009, 7:48pm UTC](https://forum.kirupa.com/t/making-an-object-without-a-pointer/284216 "2009-03-16T19:48:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![NeoDreamer](https://avatars.discourse-cdn.com/v4/letter/n/ccd318/32.png) [@NeoDreamer](https://forum.kirupa.com/u/NeoDreamer)\
**Post date:** [March 16, 2009, 7:48pm UTC](https://forum.kirupa.com/t/making-an-object-without-a-pointer/284216/1 "2009-03-16T19:48:02Z")

</div>

What’s the difference between creating an object with a pointer and without a pointer?

```auto

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?
