Description: #include <stdio.h>
#define SIZE 100//数组最大长度
#define SWAP(x, y, t) (t = x, x = y, y = t)//交换两个数
void sort(int**p, int n){//排序函数
int i, j
int min
int temp
for(i = 0 i < n- 1 i++){
min = i
for(j = i+ 1 j < n j++){
if(*(*p+ min) >*(*p+ j) ){
min = j
}
}
SWAP(*(*p+ i),*(*p+ min), temp)
}
}
void main(void){
int n
int*q
int**p
int arr[SIZE]
q = arr
p = &q //将指向数组的指针的地址赋给指针的指针
printf("please enter the size of the array: ") //输入要排序的数的个数
scanf(" d", &n)
printf("please enter the element of the array: \n") //输入要排序的数
for(int i = 0 i < n i++){
scanf(" d", &arr[i])
}
sort(p, n)
for(i = 0 i < n i++)
{
printf(" d ", arr[i]) //输出排序后的数组
}
printf("\n")
return
}
To Search:
File list (Check if you may need any files):
paixu.doc