#include <stdlib.h>
#include <stdio.h>
typedef struct schedule {
int day;
char title[100];
struct schedule *next;
} SCHEDULE;
int main(void) {
int continuebool;
SCHEDULE *now, *sch;
now = sch;
while (continuebool) {
printf("\nType title(char*):"); scanf("%s", now
->title
); printf("\ncontinue(1/0):"); scanf("%d", &continuebool
);
if(continuebool){
now
->next
= malloc(sizeof *now
->next
); now = now->next;
}
}
for (now = sch; now; now = now->next) {
printf("\nday:%d\n", now
->day
); printf("title:%s\n", now
->title
); }
return 0;
}
I2luY2x1ZGUgPHN0ZGxpYi5oPgojaW5jbHVkZSA8c3RkaW8uaD4KCnR5cGVkZWYgc3RydWN0IHNjaGVkdWxlIHsKICAgICAgICBpbnQgZGF5OwogICAgICAgIGNoYXIgdGl0bGVbMTAwXTsKICAgICAgICBzdHJ1Y3Qgc2NoZWR1bGUgKm5leHQ7Cn0gU0NIRURVTEU7CgppbnQgbWFpbih2b2lkKSB7CiAgICBpbnQgICAgICAgY29udGludWVib29sOwogICAgU0NIRURVTEUgKm5vdywgKnNjaDsKCiAgICBzY2ggPSBtYWxsb2Moc2l6ZW9mICpzY2gpOwogICAgbm93ID0gc2NoOwogICAgd2hpbGUgKGNvbnRpbnVlYm9vbCkgewogICAgICAgIHByaW50ZigiXG5UeXBlIGRheShpbnQpOiIpOyAgICAgc2NhbmYoIiVkIiwgJm5vdy0+ZGF5KTsKICAgICAgICBwcmludGYoIlxuVHlwZSB0aXRsZShjaGFyKik6Iik7IHNjYW5mKCIlcyIsIG5vdy0+dGl0bGUpOwogICAgICAgIHByaW50ZigiXG5jb250aW51ZSgxLzApOiIpOyAgICAgc2NhbmYoIiVkIiwgJmNvbnRpbnVlYm9vbCk7CgogICAgICAgIGlmKGNvbnRpbnVlYm9vbCl7CiAgICAgICAgICAgIG5vdy0+bmV4dCA9IG1hbGxvYyhzaXplb2YgKm5vdy0+bmV4dCk7CiAgICAgICAgICAgIG5vdyA9IG5vdy0+bmV4dDsKICAgICAgICB9CiAgICB9CgogICAgZm9yIChub3cgPSBzY2g7IG5vdzsgbm93ID0gbm93LT5uZXh0KSB7CiAgICAgICAgcHJpbnRmKCJcbmRheTolZFxuIiwgbm93LT5kYXkpOwogICAgICAgIHByaW50ZigidGl0bGU6JXNcbiIsIG5vdy0+dGl0bGUpOwogICAgfQoKICAgIHJldHVybiAwOwp9Cg==