#include <stdio.h>
// swap関数の定義
void swap(int *a, int *b) {
int temp = *a;
*a = *b;
*b = temp;
}
// sort関数の定義
void sort(int *x, int *y) {
if (*x < *y) {
swap(x, y);
}
}
int main(void) {
int x = 2, y = 3;
printf("Before sorting: x = %d, y = %d\n", x
, y
); sort(&x, &y);
printf("After sorting: x = %d, y = %d\n", x
, y
);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgovLyBzd2Fw6Zai5pWw44Gu5a6a576pCnZvaWQgc3dhcChpbnQgKmEsIGludCAqYikgewogICAgaW50IHRlbXAgPSAqYTsKICAgICphID0gKmI7CiAgICAqYiA9IHRlbXA7Cn0KCi8vIHNvcnTplqLmlbDjga7lrprnvqkKdm9pZCBzb3J0KGludCAqeCwgaW50ICp5KSB7CiAgICBpZiAoKnggPCAqeSkgewogICAgICAgIHN3YXAoeCwgeSk7CiAgICB9Cn0KCmludCBtYWluKHZvaWQpIHsKICAgIGludCB4ID0gMiwgeSA9IDM7CgogICAgcHJpbnRmKCJCZWZvcmUgc29ydGluZzogeCA9ICVkLCB5ID0gJWRcbiIsIHgsIHkpOwogICAgc29ydCgmeCwgJnkpOwogICAgcHJpbnRmKCJBZnRlciBzb3J0aW5nOiB4ID0gJWQsIHkgPSAlZFxuIiwgeCwgeSk7CgogICAgcmV0dXJuIDA7Cn0K