How do you initialise a dynamic array in C++?

arrays, c++

Solution

char* c = new char[length]();

Problem

How do I achieve the dynamic equivalent of this static array initialisation: ``` char c[2] = {}; // Sets all members to '\0'; ``` In other words, create a dynamic array with all values initialised to the termination character: ``` char* c = new char[length]; // how do i amend this? ```

Original source