A dynamic array of employees. (Note that you cannot declare a dynamic array within the struct definition. You only need to create a pointer to point to the dynamic array within the definition. Array is already allocated within code example

Example 1: c++ delete dynamically allocated array

int length = 69;
int * numbers = new int[length];
delete[] numbers;

Example 2: c++ allocate dynamic with initial values

int length = 50;
int *array = new int[length]();
// returns 50 length array of 0

Tags:

Cpp Example