#define N 8
unsigned char arr[N]={10,2,5,7,6,3,18,11};
unsigned char SortData(unsigned char *DataPTR)
{
unsigned i,j,tmp,ReturnData;
for(i = 0 ;i <N; i ++)
{
for(j = 0; j<N-i-1;j++)
{
if(*(DataPTR+j+1) < *(DataPTR+j))
{
tmp = *(DataPTR+j+1);
*(DataPTR+j+1)=*(DataPTR+j);
*(DataPTR+j) = tmp ;
}
}
}
ReturnData=arr[N/2];
return ReturnData;
}
main()
{
unsigned char m;
m=SortData(arr);
while(1);
}
文章评论(0条评论)
登录后参与讨论