dptr and bptr_1 both point to the same allocated objected. You should only delete an object once, as soon as you delete it the pointer becaomes invalid and any access to that pointer, either dereferencing it or trying to delete it again is undefined behavior.
You allocate the object pointed to by dptr and bptr_1 at line 22 but then you try to delete it at lines 32, 46 and 52. This will always cause an error.
Only delete an object once.
Banfa
Practically a Master Poster
695 posts since Mar 2010
Reputation Points: 508
Solved Threads: 109
Skill Endorsements: 5
Question Answered as of 1 Year Ago by
Banfa
and
nullptr