Answer to Question heap-8

It deletes the array before returning it. So it returns a dangling pointer.