#include <stdio.h>
int main()
{
/* Sample program. Task: to exchange the contents of two variables.
It is impossible to accomplish without using an intermediary.
*/
int x, y; /* the two given variables */
int z; /* the auxiliary variable */
/* initialization */
x=2004;
y=2005;
printf("Initially: x=%d, y=%d\n", x,y); /* prints: x=2004, y=2005 */
/* swap procedure */
z=x;
x=y; /* x has changed, but old value is saved in z */
y=z; /* copying old value of x into y */
printf("After swap: x=%d, y=%d\n", x,y); /* prints: x=2005, y=2004 */
return (0);
}