Assignment 2 Array doubling with dynamic memory Solution