看板 C_and_CPP 關於我們 聯絡資訊
設定結構data 其結構變數student[5] 設定一函數 struct data best(struct data student[]) { 這裡取最大值的index return student[index]; } 想問要怎麼在main中接受這個傳回值 我設student[4]=struct data best(student); 跟另外定義一個struct data temp; temp=struct data best(student); 這兩種都不行。。 請問下傳回值為結構元素怎麼接受0.0 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 111.82.188.254 ※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1463294930.A.F3F.html ※ 編輯: Neverfor (111.82.188.254), 05/15/2016 14:55:08
bibo9901: 回傳int 你會寫 num = int func(); 嗎?05/15 15:04
bibo9901: 寫 temp=best(student); 就好05/15 15:04
我暈了我 竟然忘記函數怎麼用 感恩 ※ 編輯: Neverfor (111.82.188.254), 05/15/2016 15:08:52
chuegou: 我想把index傳回來 temp = student[best()]; 05/15 15:14