Don't see any need to use dynamic allocation.
If your real code does need to use it, consider a std::vector
>
arrPtr = temp;
leak, and invalid delete on the destructor.
you need `std::copy()' or `memcpy()'
> I'm getting it when my program ends, otherwise the program runs just fine so
> I "think" it has something to do with the Destructor.
you've got a memory corruption problem.
your destructor may be correct (in this case it is not), but the meddling that do the other functions may be giving it invalid pointers to work on.
may use tools such as valgrind to detect invalid frees, but you'll have to track the code to figure out why does it happens.
Or instead you may follow the rule of zero and don't have to worry about anything.
http://en.cppreference.com/w/cpp/language/rule_of_three
> there is no need to try and delete each element.
clang even gives you an error (gcc, a cryptic warning)
foo.cpp:38:3: error: cannot delete expression of type 'char [3]'
delete[] arrPtr[i];
^ ~~~~~~~~ |