問題(Question):
會使用call by address 跟 linked list 但是合起來用就不會用
希望解惑 謝謝
主要的程式碼:
class node //linked list製作
{
public:
int data;
node *link;
};
node *invert1(node *first) //反轉串列
{
node *p=first;
node *x0=NULL,*s1;
while(p!=NULL)
{
s1=p->link;
p->link=x0;
x0=p;
p=s1;
}
first=x0;
return first;
}
能使用傳回值的形式反轉串列
但是要如何使用call by address 或 call by reference 反轉串列呢?
希望高手解惑謝謝
程式碼(Code):(請善用置底文網頁, 記得排版,禁止使用圖檔)
全部程式碼:
http://codepad.org/UyOunoNW