c8-4.c 357 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 two integer numbers:");
  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 *p;
  16. p=p1;
  17. p1=p2;
  18. p2=p;
  19. }