120k views
5 votes
)Dynamically allocate an object of Banana, using the pointer variable daco.

a)Banana * = new daco;

b)daco = new * Banana;

c)daco = new & Banana;

d)daco = new Banana;

2 Answers

2 votes

Answer:

What can I help you with:)

Step-by-step explanation:

User Nika Roffy
by
6.8k points
1 vote

Answer:

d) daco = new Banana;

Step-by-step explanation:

Dynamically allocated variables have their memory allocated in the heap memory.We declare a dynamical variable like this:-

int *a=new int ;

It means a pointer a is created on the stack memory which hold the address of the block that hold the value of variable a in heap memory.

We already have the pointer daco. We just have to initialize with keyword new.

It will be like daco=new Banana; which matches the option d.

User Hugo
by
6.4k points