Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

資料結構的問題~

0 views
Skip to first unread message

我想(b)

unread,
Nov 17, 1999, 3:00:00 AM11/17/99
to
目前我用bcb寫一個鏈結串列的程式~如下是一個插入的工作;
typedef struct node
{
int data;
struct node *link;
}node;
typedef node *list;

void insert(int x,list)
{
list *p,*q,*nd,**list;
nd=(*list)calloc(1,sizeof(list)); =>這一行有問題,可是我不知道它的語法是什
nd->data=x; 麼才對?
if(*list==NULL){
nd->link=NULL;
*list=nd;
}
else{
if(x<p->x){
nd->link=p;
*list=nd;}

else{
while(p!=NULL&&x>p->x)
q=p;p=p->link;
}
}
}

--
妳好呀~~我是藍月~~很高興認識妳~~

--
◎ [1;31m龍 [32m貓 [33m資 [34m訊 [35m天 [36m地 [0m( [1mbbs.mgt.ncu.edu.tw [0m)
◎[ [1;33;46mnew852072 [0m]來自: 210.240.249.31

0 new messages