有一链式结构定义如下 :struct stuchar name20;int no;struct stu next;;创建一个函数myindexheadname在链表head中查找name域为name的结点返回查找后结果。如果p链表中结点的name域与name相同返回该结点的地址如果没找到返回NULL。 程序中create函数已经为我们创建了一个有10个结点的无头结点的链表。函数接口定义:在这里描述
struct stu * myindex(struct stu *head,char *name){ while(head){ if(strcmp(head->name,name)==0) return head; head=head->next; } return NULL; }
原文地址: https://www.cveoy.top/t/topic/cFGQ 著作权归作者所有。请勿转载和采集!