Avoid memory leaks in C++ Pointers [closed]

I follow some simple rules: don’t do manual memory allocations. If you find yourself writing a manual delete, stop and think twice. use std::string instead of C-style strings use std::vector<T> instead of C-arrays (or std::array<T> for fixed-sized arrays) use std::unique_ptr and std::make_unique by default use std::shared_ptr if necessary use RAII wrappers for other resources, e.g. … Read more