Hydrogen-python/test5.c
2025-06-11 19:51:42 +08:00

30 lines
468 B
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* test5冒泡排序数组访问模拟*/
int swap(int i, int j) {
int temp;
temp = i;
i = j;
j = temp;
return 0;
}
int main() {
int a;
int b;
int c;
int d;
int e;
a = 5;
b = 3;
c = 8;
d = 1;
e = 9;
/* 冒泡排序模拟 */
if (a > b) { swap(a, b); }
if (b > c) { swap(b, c); }
if (c > d) { swap(c, d); }
if (d > e) { swap(d, e); }
return e;
}