作者owlran (鳌伦)
看板C_and_CPP
标题[问题] 将结构阵列传入函数的问题
时间Thu Mar 26 11:28:35 2009
http://rafb.net/p/bDynfG16.html
↑程式码,中文显是不出来 orz.
宣告函数void swap(struct data *,struct data *,struct data *);
可是我的struct是用阵列存的
这样我该怎麽丢进去 .. ?
本来是想 swap(tri_comp[0],tri_comp[1],tri_comp[2]);
这样放的,结果不可行 ..
--
谢谢Q大解答
all跟data改过就OK了
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.134.241.19
※ 编辑: owlran 来自: 140.134.241.19 (03/26 11:36)
1F:推 QQ29:swap(tri_comp,tri_comp,tri_comp); 型态是all 03/26 11:41
2F:→ QQ29:你用 data型态的指标去接 03/26 11:42
3F:→ QQ29:丢tri_comp[0].tri[0]~~~才是你要的吧? 03/26 11:44
4F:→ QQ29:还要加个& 03/26 11:44
5F:推 freelancer:swap(&tri_comp[0],&tri_comp[1],&tri_comp[2]) 03/26 13:15
6F:→ freelancer:看太快,一楼之对的... 03/26 13:16
※ 编辑: owlran 来自: 140.134.203.7 (03/26 15:25)
※ 编辑: owlran 来自: 140.134.203.7 (03/26 15:26)