第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定

為什么,我的數(shù)組排序后不能返回排序后的數(shù)組??!

#include <stdio.h>

#define N 10

int totall(int score[]) ? //考試的總分

{

? ? int i,totall=0;

? ? for(i=0;i<N;i++)

{

? ? totall+=score[i];

}

return totall;

}

int Max(int score[])

{

? ? int i,max=0;

? ? for(i=0;i<N;i++)

{

? ? if(score[i]>max)

{

? ? max=score[i];

}

}

return max;

}

int Low(int score[])

{

? ? ?int i,min;

min=score[0];

for(i=0;i<N;i++)

{

? ? ?if(score[i]<min)

?min=score[i];

}

return min;

}

int average(int score[])

{

? ? ?int aver,sum;

sum=totall(score);

aver=sum/N;

return aver;

}

int sort(int score[])

{

?int i,j;

? ? ? for(i=8;i>=0;i--)

?for(j=0;j<=i;j++)

?{

?int temp;

? ? ?if(score[j]<score[j+1])

?{

? ? ? temp=score[j+1];

? score[j+1]=score[j];

? score[j]=temp;

?}

?}

?return score[N];

}

int main()

{

? ? int score[N]={67,98,75,63,82,79,81,91,66,84};

printf("總分是:%d\n",totall(score));

printf("最高分是:%d\n",Max(score));

printf("最低分是:%d\n",Low(score));

printf("平均分是:%d\n",average(score));

printf("考試成績降序排序:%d\n",sort(score));

? ? return 0;

}


正在回答

3 回答

樓主可以搜一搜 ”按址傳遞和按值傳遞“;

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

補(bǔ)食者 提問者

非常感謝!
2016-02-16 回復(fù) 有任何疑惑可以回復(fù)我~

好的,謝謝。


0 回復(fù) 有任何疑惑可以回復(fù)我~

不需要返回?cái)?shù)組,傳到sort中的是指針,sort函數(shù)是直接在原數(shù)組上進(jìn)行操作

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

為什么,我的數(shù)組排序后不能返回排序后的數(shù)組??!

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號