When i run valgrind on below program, it reports memory leak. Can you please explain the cause?
#include <string> #include <iostream> using namespace std; int main() { char * arr = (char *) ::operator new(sizeof(char)); string s = arr; return 0; } - What exactly happens on line string s = arr? does it make a copy of arr?
std::stringwill not magically free your array