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

#include <stdio.h> #include <stdlib.h> 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); } }
DOUBLE_l
浏览 1408回答 3
3回答

DOUBLE_l

#include <stdio.h> #include <stdlib.h> 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,查看更多内容
随时随地看视频慕课网APP