C言語なら俺に聞け! Part 100
■ このスレッドは過去ログ倉庫に格納されています
0176デフォルトの名無しさん
05/01/24 14:38:14のですがこの後がわかりません。どうしたらいいのでしょうか?
typedef struct Station {
char name[256];
struct Station *next;
} Station;
int main(void)
{
Station *currents;
Station *lasts = NULL;
char buf[256];
currents = malloc(BUFSIZE);
printf("駅名入力(終了キー:/e)\n");
while (1) {
fgets(buf, sizeof(buf), stdin);
buf[strlen(buf) - 1] = '\0';
if (strcmp(buf, "/e") == 0)
break;
strcpy(currents->name, buf);
currents->next = malloc(sizeof(BUFSIZE));
lasts = currents;
}
return 0;
}
■ このスレッドは過去ログ倉庫に格納されています