char* new and delete [] error when a string is assigned-Collection of common programming errors
What you’re doing is assigning pear
to an allocated array of chars on the heap, and then reassigning it to point to the string which is in a static location. If you try to delete that it will error because you’re not supposed to delete stuff in that static location.