Create swap.c

Code for Homework #3.