Cognizant interview question

Write a code to swap the numbers in an array.