C语言高手帮我填空#include <stdio.h>#include <stdlib.h>#define N 8typedef struct list{ int data; struct list *next;} SLIST;SLIST *creatlist(int *);void outlist(SLIST *);int fun( SLIST *h){ SLIST *p; int s=0;
来源:学生作业帮助网 编辑:作业帮 时间:2024/06/28 16:04:32
![C语言高手帮我填空#include <stdio.h>#include <stdlib.h>#define N 8typedef struct list{ int data; struct list *next;} SLIST;SLIST *creatlist(int *);void outlist(SLIST *);int fun( SLIST *h){ SLIST *p; int s=0;](/uploads/image/z/14323575-39-5.jpg?t=C%E8%AF%AD%E8%A8%80%E9%AB%98%E6%89%8B%E5%B8%AE%E6%88%91%E5%A1%AB%E7%A9%BA%23include+++%26lt%3Bstdio.h%26gt%3B%23include+++%26lt%3Bstdlib.h%26gt%3B%23define+++N++++8typedef+struct+list%7B+int++data%3B++struct+list++%2Anext%3B%7D+SLIST%3BSLIST+%2Acreatlist%28int++%2A%29%3Bvoid+outlist%28SLIST++%2A%29%3Bint+fun%28+SLIST++%2Ah%29%7B+SLIST++%2Ap%3B+++++++++int+s%3D0%3B)
C语言高手帮我填空#include <stdio.h>#include <stdlib.h>#define N 8typedef struct list{ int data; struct list *next;} SLIST;SLIST *creatlist(int *);void outlist(SLIST *);int fun( SLIST *h){ SLIST *p; int s=0;
C语言高手帮我填空
#include <stdio.h>
#include <stdlib.h>
#define N 8
typedef struct list
{ int data;
struct list *next;
} SLIST;
SLIST *creatlist(int *);
void outlist(SLIST *);
int fun( SLIST *h)
{
SLIST *p; int
s=0;
p=h->next;
while(p)
{
//
printf("\nsum=%d\n", fun(___3___));
}
SLIST *creatlist(int a[])
{
SLIST *h,*p,*q; int
i;
h=p=(SLIST *)malloc(sizeof(SLIST));
for(i=0; i<N; i++)
{ q=(SLIST
*)malloc(sizeof(SLIST));
q->data=a[i];
p->next=q; p=q;
}
p->next=0;
return h;
}
void outlist(SLIST *h)
{ SLIST *p;
p=h->next;
if
(p==NULL) printf("The list is
NULL!\n");
else
{ printf("\nHead ");
do
{ printf("->%d",
p->data); p=p->next; }
while(p!=NULL);
printf("->End\n");
}
}
C语言高手帮我填空#include <stdio.h>#include <stdlib.h>#define N 8typedef struct list{ int data; struct list *next;} SLIST;SLIST *creatlist(int *);void outlist(SLIST *);int fun( SLIST *h){ SLIST *p; int s=0;
1 . data
2. next
3. head
运行结果: