PCZONE 討論區 - 觀看單一文章 - 【求助】TC的指標問題
觀看單一文章
金田一
會員

我的想法是....
for(i=1;i<num;i++)
{
tmp2=(link)malloc(sizeof(node));
tmp2->next=NULL;
tmp2->data=array[i];
tmp1->next=tmp2;
tmp1=tmp1->next;
}
是如何將tmp2指向tmp2->next呢?
step:
1.將tmp2指向一個結構位址
2.tmp2.next=NULL
3.tmp2.data=array[i]
4.將tmp1->next指向tmp2,使其連接
5.將tmp1指向tmp1.next
6.再次 將tmp2指向一個結構位址.故請問這時的tmp2不是應指向tmp2->next了嗎?
......
謝謝回答
回覆