for(p = head; p->next = NULL; p = p->next);p->next = int insert(int id){node_t *p,*q;/* creat new node */q = new_node(id);if(q == NULL) return -1;/* nothing in the link */if(head == NULL){head = q; return 0;}/* get the last one */for(p = head; p->nex

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/25 17:07:23
for(p=head;p->next=NULL;p=p->next);p->next=intinsert(intid){node_t*p,*q;/*creatnewnode*/q=new_node(i

for(p = head; p->next = NULL; p = p->next);p->next = int insert(int id){node_t *p,*q;/* creat new node */q = new_node(id);if(q == NULL) return -1;/* nothing in the link */if(head == NULL){head = q; return 0;}/* get the last one */for(p = head; p->nex
for(p = head; p->next = NULL; p = p->next);p->next =
int insert(int id)
{
node_t *p,*q;
/* creat new node */
q = new_node(id);
if(q == NULL) return -1;
/* nothing in the link */
if(head == NULL){
head = q; return 0;
}
/* get the last one */
for(p = head; p->next = NULL; p = p->next);
/* get into the link */
p->next = q;
return 0;
}
最后那两句不太明白呀.q是最后一个结点么

for(p = head; p->next = NULL; p = p->next);p->next = int insert(int id){node_t *p,*q;/* creat new node */q = new_node(id);if(q == NULL) return -1;/* nothing in the link */if(head == NULL){head = q; return 0;}/* get the last one */for(p = head; p->nex
应该是一个链表指针p的遍历,直到结尾p==NULL

for(p = head; p->next = NULL; p = p->next);p->next = int insert(int id){node_t *p,*q;/* creat new node */q = new_node(id);if(q == NULL) return -1;/* nothing in the link */if(head == NULL){head = q; return 0;}/* get the last one */for(p = head; p->nex C语言 中&和 请参照这个程序#include#define NULL 0struct student{int num;float score;struct student *next;};void main(){struct student *head,a,b,c,*p;a.num=8011;a.score=90.5;b.num=7022;b.score=99;c.num=7033;c.score=88;head=&a;a.next=&b;b.nex ctstudent*head,intagp1=p->next;for(b=3;b for(p=0;p for(p=0;p 答案是p->next=head 还是p->next!=head head->next!=p与head=p的区别head->next=p与head=p有什么区别?题目写错了是head->next=p 每一步都说的什么,#include using namespace std; const int people = 17; struct outt { outt *next; bool go; int num; }; int main( ) { outt *p,*head; int i,n = 0,t = 0; head = new outt; head->go = true; head->num = 1; p = head; for ( i = 1; i < p 两题单链表逆置,求讲解1.p=head->next;head->next=NULL;while(p){s=p;p=p->next;s->next=head->next;head->=s;}p=head-next;2.p=head->next;q=p->next;p->next=NULL;while(q!=NULL){r=q->next;q->next=p;p=q;q=r;} head->next=p;本人初学数据结构, d=sear(p,head)head=insert(head,p)tou=dele(tou,head,name)head=del(head,name)tou=creat1(head)fread(p1,LEN,1,fp1 带头单链表逆置,下面程序有错吗?p=head->next;q=p->next;什么意思?void linklist_rev1(linklilst head); p=head->next;head->next=NULL;while(p){q=p->next;p->next=head->next;head->next=p;p=q;} c++数据结构指针问题(就地逆置)p=head;while(head->next!=NULL){q=p;结点赋结点什么意思?p=head->next;指针赋结点什么意思?head->next=p->next;指针赋指针什么意思?p->next=q;}head=p;p=head;(求每一句的解释) 数据结构题目:双链表中,在*p结点之后插入一个结点*s的操作是?双链表中,在*p结点之后插入一个结点*s的操作是( )A.s->prior=p;p->next=s;p->next->prior=s;s->next=p->next;B.s->next=p->next;p->next->prior=s;p->nex for(++p;p int *p,a[10]; for(p=a;p 麻烦解释下下面C语言中的句子,数据结构的,请赐教Status insert(linklist *head,int i){linklist *p,*q;int j,m;p=head;for (j=1;jdata.key=m;q->data.num=j;q->next=p->next;p->next=q;p=p->next;}return ok;}中的q->data.key=m;q->data.num=j; 谁能解释下下面的数据结构的算法啊~尤其是循环的部分linklist *reverlist(linklist *head) //逆置链表子函数{linklist *q,*p;if(head && head->next) { p=head; q=p->next;p->next=NULL;while(q){p=q;q=q->nextp->next=head;hea 谁能帮我解释下这个函数是怎么工作的!那个for循环循环几次,return struct list *input_list() /*链表的创建和初始化--数据存储*/{ struct list *head,*tail,*p;int x,i;head=(struct list *)malloc(size);head->exp=0;head->