Consider you want to allocate memory for an array of characters i.e. string of 20 characters. Using the same syntax what we have used above we can allocate memory dynamically as shown below.

char* pvalue  = NULL;   // Pointer initialized with null
pvalue  = new char[20]; // Request memory for the variable
To remove the array that we have just created the statement would look like this:

delete [] pvalue;        // Delete array pointed to by pvalue
Following the similar generic syntax of new operator, you can allocat for a multi-dimensional array as follows:

double** pvalue  = NULL;     // Pointer initialized with null
pvalue  = new double [3][4]; // Allocate memory for a 3x4 array
However the syntax to release the memory for multi-dimensional array will still remain same as above:

delete [] pvalue;        // Delete array pointed to by pvalue


If Have Any Problem :-C++ Problem Solve
Designed By Blogger Templates | Templatelib & Distributed By Blogspot Templates