快捷导航

大神快看看我的动态链表哪里错了

#include #include typedef struct Date{int year;int month;int day;struct Date* next;}date;void main(){   int i;                                date*head,*p,*p1;                                *p=(date*)malloc(sizeof(date));                                p1=head=p;                                for(;p->next!=NULL;)                                {                                                                scanf("%d,%d,%d",&p->year,&p->month,&p->day);                                                                if(p->year==0&&&p->month==0&&p->day==0)                                                                                                {p->next=NULL;continue;}                                                                *p=*p=(date*)malloc(sizeof(date));                                                                p1->next=p;                                                                p1=p;                                                }                                 for(;head->next!=NULL;)                                {                                                                        printf("%d,%d,%d\n"head->year,head->month,head->day);                                } }

免责声明:本内容仅代表回答者见解不代表本站观点,请谨慎对待。

版权声明:作者保留权利,不代表本站立场。

回复

使用道具 举报

参与会员1

#include  #include  typedef struct Date{ int year; int month; int day; struct Date* next;}date; void main() { int i; date*head,*p,*p1; *p=(date*)malloc(sizeof(date)); p1=head=p; for(;p->next!=NULL;) {    scanf("%d,%d,%d",&p->year,&p->month,&p->day);  if(p->year==0&&&p->month==0&&p->day==0) {p->next=NULL;continue;} *p=*p=(date*)malloc(sizeof(date)); p1->next=p; p1=p;        } for(;head->next!=NULL;) { printf("%d,%d,%d\n"head->year,head->month,head->day); } }快看看,
回复

使用道具 举报

可能感兴趣的问答

发新帖
  • 微信访问
  • 手机APP