切换到宽版
  • 10396阅读
  • 2回复

(求救)关于函数引用 [复制链接]

上一主题 下一主题
离线fuhuo1991
 
只看楼主 倒序阅读 0 发表于: 2008-03-16
函数声明如下:
int insert(Seqlist L,int i,T item)
作用在数组第i与i+1个元素见插入item;
那么前面的Seqlist L的L是否需要引用?
我记得函数执行时会创建另外的空间来运算的,
那么insert也就是对形参数组进行了操作,对
原来的数组是否也进行了操作?
希望高人解答
离线kodylau
只看该作者 1 发表于: 2008-03-17
如果想改变Seqlist的内容的话,L需要使用引用。
不使用引用的话,函数执行的时候创建一个L的拷贝并对其进行操作,所以L实际上并没有发生改变。
要想对原来的数组操作,就要传引用或者指针。
离线灯泡泡灯
只看该作者 2 发表于: 2008-05-05
请大家鼓掌支持
我z喜欢,请大家鼓掌支持,谢谢

---------------
Where you may get the best price for world of warcraft gold, and the fastest delivery of gold on world of warcraft with no minimal purchase necessary! We rock the World of warcraft gold EU market by continue to lower our lowest price !  world of warcraft gold EU and world of warcraft gold US at our webgage! Welcome to our website for you World of Warcraft Gold,WoW Gold,Cheap World of Warcraft Gold,buy cheap WoW Gold,real WoW Gold !
快速回复
限100 字节
 
上一个 下一个