   Question about dynamic pointers
  HiIn the following C++ code:-----------------------------------int main(){int **ptr = new int*[10];for(int i = 0; i < 10; i++)ptr = new int;delete [] ptr; ptr = 0;return 0;}------------------------------------Are the dynamically allocated arrays ( by "ptr = new int" )also deleted after the statement "delete [] ptr; ptr = 0;"   ?Thank you
  No.   ;  Thank you (^ ')b   ;  There are two quick ways to test your guess:* Use a debugger* Use a custom class type**#include <iostream>class X {public:    X () {   std::cout << "created [" << this << "]" << std::endl;    }    ~X () {   std::cout << "deleted [" << this << "]" << std::endl;    }};int main(){    X **ptr = new X*[10];    for(int i = 0; i < 10; i++)   ptr = new X;    delete [] ptr;    ptr = 0;    return 0;}Now if you get for each "created [xxx]" a corresponding "deleted [xxx]", your code does not leak.   