Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote