VIPPERでもわかるプログラミング
■ このスレッドは過去ログ倉庫に格納されています
0565デフォルトの名無しさん
2005/11/13(日) 00:04:44{
struct list head = {&head, &head, "", 0}, *lp, *p, tmp;
while(1) {
if(input_list(&tmp) < 0) break;
if(!(p = (struct list *)malloc(sizeof(struct list)))) {
printf("もうパンパンだお。諦めて入力終了するお。\n");
continue;
}
for(lp = head.next; lp != &head && strcmp(lp->name, tmp.name) < 0; lp = lp->next);
*p=tmp; list_insert(p, lp);
}
printf("\n\n");
for(lp = head.next; lp != &head; lp = lp->next) {
printf("%s %d\n", lp->name, lp->age);
}
list_free(&head);
return 0;
}
■ このスレッドは過去ログ倉庫に格納されています