use pointer to handle swap
Chapter 13