Having issues with this question. Q. In terms of memory allocation, what is the
ID: 3909943 • Letter: H
Question
Having issues with this question.
Q. In terms of memory allocation, what is the difference between declaring Object obj; and Object *pObj;?
Object obj; creates an expandable, dynamic memory space, and Object *pObj; creates a fixed, static memory space.
Object obj; allocates space for an object and creates the object in that space, but Object *pObj; only declares a pointer and nothing more.
Object obj; allocates space for an object and creates the object in that space, and Object *pObj; creates an object with a pointer attached to it.
Object obj; allocates space for an object but does not create the object until it is needed, and Object *pObj; creates the object.
Object obj; creates an expandable, dynamic memory space, and Object *pObj; creates a fixed, static memory space.
Object obj; allocates space for an object and creates the object in that space, but Object *pObj; only declares a pointer and nothing more.
Object obj; allocates space for an object and creates the object in that space, and Object *pObj; creates an object with a pointer attached to it.
Object obj; allocates space for an object but does not create the object until it is needed, and Object *pObj; creates the object.
Explanation / Answer
Here the initialization of an object allocates some space and if object is declared with Object *pobj; creates an object with a pointer attached to it.
Hence Option 3 is the right answer.
Thanks.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.