home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_11_08
/
1108114a
< prev
next >
Wrap
Text File
|
1993-06-08
|
334b
|
25 lines
/* swap2.c: A working swap function */
#include <stdio.h>
void swap(int *, int *);
main()
{
int i = 7, j = 8;
swap(&i,&j);
printf("i == %d, j == %d\n",i,j);
return 0;
}
void swap(int *xp, int *yp)
{
int temp = *xp;
*xp = *yp;
*yp = temp;
}
/* OUTPUT:
* i == 8, j == 7 */