#include
#define N 10
void input(int *t,int n)
{ int i;
for(i=0;i
}
void output(int *t,int n)
{ int i;
for(i=0;i
}
void sort(int *t,int n)
{
int max_index=n-1, min_index=0;
for(int i=0;i
if(t[i]>t[max_index]){
max_index = i;
}
if(t[i]
}
}
int temp =0;
temp = t[0];
t[0] = min;
t[min_index] = temp;
temp = t[n-1];
t[n-1]=max;
t[max_index] = temp;
}
void main()
{ int p[N]; printf("输入%d个数\n",N); input(p,N); sort(p,N); printf("输出:");
output(p,N); printf("\n");}
开始忘了加个花括号,此处已改正
你对指针了解有点问题,建议你多看看书,一言两语真的无法为你解释清楚,这是我按你思路改写好的。数组a[i]的表示方法有*(a+i),*a就是a[0]。所以你根本不用定义*p[],这个主要是用在二维数组上