// pseudo code for swap // The following declares the following global integer variables Declare Integer A, B, Temp // the main module Module main() // assign the global variables values Set A = 1 Set B = 2 Set Temp := 3 Display "Before exchange ", A , B, Temp Exchange(A,B) Display "After exchange ", A, B, Temp end Module // Swaps the variables that were passed into the call by reference parameters Module Exchange(Integer Ref X, Integer Ref Y) // Local Temp variable for the swap Declare Integer Temp // Set the value of local temp variable Set Temp = X Set X = Y Set Y = Temp Display "Inside Exchange ", X, B, Temp) End Module // Exchange