【文件属性】:
文件名称:c复习资料整理
文件大小:1.79MB
文件格式:DOC
更新时间:2015-10-14 04:08:30
c语言
#include
#include
#define N 8
typedef struct list
{ int data;
struct list *next;
} SLIST;
SLIST *creatlist(char *);
void outlist(SLIST *);
int fun( SLIST *h, char ch)
{ SLIST *p; int n=0;
p=h->next;
/**********found**********/
while(p!=___1___)
{ n++;
/**********found**********/
if (p->data==ch) return ___2___;
else p=p->next;
}
return 0;
}
main()
{ SLIST *head; int k; char ch;
char a[N]={'m','p','g','a','w','x','r','d'};
head=creatlist(a);
outlist(head);
printf("Enter a letter:");
scanf("%c",&ch;);
/**********found**********/
k=fun(___3___);
if (k==0) printf("\nNot found!\n");
else printf("The sequence number is : %d\n",k);
}
SLIST *creatlist(char *a)
{ SLIST *h,*p,*q; int i;
h=p=(SLIST *)malloc(sizeof(SLIST));
for(i=0; i