Reversing the order of elements in the list using manipulation of pointers