Selasa, 30 Agustus 2016

How to allocate memory for the array of objects in C++

Dynamic memory allocation for array of objects   In the previous topic memory for array of objects was static as the memory was allocated at compile time. To allocate memory dynamically or at run time, we use an array of pointers which can be created as follows: ClassName *array-name;   Memory allocated for an array of pointers is far less than memory allocated for an array of objects. We can create an object at run time using the newoperator as follows: array-name = new ClassName;   After dynamically allocating memory for an object we access the members using the ->

The post How to allocate memory for the array of objects in C++ appeared first on Coding Security.


How to allocate memory for the array of objects in C++
read more

Tidak ada komentar:

Posting Komentar