how to create an array of integers on the heap code example
Example 1: heap allocated array in c ++
#include <vector>
std::vector<myarray> bestArray(100);
myarray* heapArray = new myarray[100];
delete [] heapArray;
std::vector<myarray> bestArray{ 1, 2, 3 };
std::vector<myarray> bestArray;
bestArray.push_back(myarray(1));
bestArray.push_back(myarray(2));
bestArray.push_back(myarray(3));
Example 2: heap allocated array in c ++
std::array<myarray, 3> stack_array;
std::vector<myarray> heap_array (3);