1
#include
"
stdio.h
"
2 void swap( int * p1, int * p2);
3 int main( void )
4 {
5 int x = 0 ,y = 200 ;
6 printf( " X = %d,Y = %d\n " ,x,y);
7 printf( " X p = %p,Y p= %p\n " , & x, & y);
8 printf( " please waiting for swaping \n " );
9 swap( & x, & y);
10 printf( " swaping end \n " );
11 printf( " X = %d,Y = %d\n " ,x,y);
12 printf( " X p = %p,Y p= %p\n " , & x, & y);
13 return 1 ;
14 }
15 void swap( int * p, int * q)
16 {
17 int t = * p;
18 * p = * q;
19 * q = t;
20 }
21
2 void swap( int * p1, int * p2);
3 int main( void )
4 {
5 int x = 0 ,y = 200 ;
6 printf( " X = %d,Y = %d\n " ,x,y);
7 printf( " X p = %p,Y p= %p\n " , & x, & y);
8 printf( " please waiting for swaping \n " );
9 swap( & x, & y);
10 printf( " swaping end \n " );
11 printf( " X = %d,Y = %d\n " ,x,y);
12 printf( " X p = %p,Y p= %p\n " , & x, & y);
13 return 1 ;
14 }
15 void swap( int * p, int * q)
16 {
17 int t = * p;
18 * p = * q;
19 * q = t;
20 }
21