// @topic W04-0-020 C/C++ pointers and arrays
// @brief swap( int* px, int *py ) example

// CIS-123 Week 04 Example program
#include <iostream>
#include <cstdlib>

void swap( int* px, int *py );

void swap( int* px, int *py ) {
	int temp = *px; // preserve x
	*px = *py;      // update x
	*py = temp;     // update y
}//swap

int main() {
	int x{ 123 };
	int y{ 456 };
	swap( &x, &y );
	std::cout << "x==" << x << "\n";
	std::cout << "y==" << y << "\n";

	system("pause");
	return 0;
}//main