当前位置:首页 > 湖南省历界对口高考C语言真题(答案)
{ int data;
struct Node *next; };
struct Node *creatlist( )
{ struct Node p,q,head; { struct Node *p,*q,*head; int a;
head=(struct Node *)malloc(sizeof(struct Node)); p=q=head;
printf(“input an interger number,enter -1 to end:\\n”); scanf(“%d”,&a); while(a!=-1)
{ p=(struct Node *)malloc(sizeof(struct Node)); p->data=a; q->next=p; q=p;
p->next=NULL; scanf(“%d”,&a); }
return head; }
main( )
{ struct Node *head,*p; head=creatlist( ); p=head->next; while(p)
{ printf(“%d\\n”,p->data);
p->next=p; p =p->next; } }
33
共分享92篇相关文档