10.5k views
5 votes
Dynamically allocatе mеmory for a DNA objеct and storе its addrеss in a variablе namеd dnaPtr

User SourD
by
4.4k points

1 Answer

4 votes

Answer:

DNA obj =new DNA;//obj object created dynamically.

DNA *dnaPtr=&obj.//dnaPtr to store the address of the object.

Step-by-step explanation:

The above written statements are in C++.The DNA object is created dynamically and it is done in C++ by using new keyword which allocates the heap memory for the object.

Then a dnaPtr is created of type DNA so that it can store the address of the DNA objects.

User Benaryorg
by
5.4k points