1
0

c8-3.c 356 B

1234567891011121314151617181920
  1. #include <stdio.h>
  2. int main()
  3. {void swap(int *p1,int *p2);
  4. int a,b;
  5. int*pointer_1,*pointer_2;
  6. printf("please enter a and b:");
  7. scanf("%d,%d",&a,&b);
  8. pointer_1=&a;
  9. pointer_2=&b;
  10. if(a<b) swap(pointer_1,pointer_2);
  11. printf("max=%d,min=%d\n",a,b);
  12. return 0;
  13. }
  14. void swap(int *p1,int *p2)
  15. {int temp;
  16. temp=*p1;
  17. *p1=*p2;
  18. *p2=temp;
  19. }