• c复习资料整理

    #include <stdio.h> #include <stdlib.h> #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<N; i++)

    0
    192
    1.79MB
    2012-09-23
    16
关注 私信
上传资源赚积分or赚钱