作业帮 > 综合 > 作业

C语言高手帮我填空#include   <stdio.h>#include 

来源:学生作业帮 编辑:搜搜考试网作业帮 分类:综合作业 时间:2024/07/11 22:49:05
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 
1 .  data

2.  next 

3.  head

运行结果: