hanoi(n-1,b,a,c); } }
第九题
#include "stdlib.h" #include "stdio.h" struct list { int data;
struct list *next; };
typedef struct list node; typedef node *link;
void main()
{ link ptr,head,tail; int num,i;
tail=(link)malloc(sizeof(node)); tail->next=NULL; ptr=tail;
printf("\nplease input 5 data==>\n"); for(i=0;i<=4;i++) {
scanf("%d",&num); ptr->data=num;
head=(link)malloc(sizeof(node)); head->next=ptr; ptr=head; }
ptr=ptr->next; while(ptr!=NULL)
{ printf("The value is ==>%d\n",ptr->data); ptr=ptr->next; }}
本文来源:https://www.wddqxz.cn/b6e980c6132de2bd960590c69ec3d5bbfc0ada56.html