1: #include <stdio.h> 2: 3: void swap(int *a, int *b) { 4: int temp = *a; 5: *a = *b; 6: *b = temp; 7: } 8: void sort3(int *x, int *y, int *z) { 9: if (*x > *y) swap(&x, &y); 10: if (*y > *z) swap(&y, &z); 11: if (*x > *y) swap(&x, &y); 12: } 13: int main(void) { 14: int p, q, r; 15: p = 4; q = 2; r = 3; 16: printf("p=%d, q=%d, r=%d\n", p, q, r); 17: sort3(&p, &q, &r); 18: printf("p=%d, q=%d, r=%d\n", p, q, r); 19: return 0; 20: }