/* 2. ´ÙÀ½ C ÇÁ·Î±×·¥ÀÇ Ãâ·ÂÀ» ½á¶ó. */ #include #include int key[5] = { 1, 2, 3, 4, 5}; struct node { int num; struct node *next; }; main() { struct node *p; struct node *q; int i; p = (struct node *)malloc(sizeof(struct node)); p->num = key[0]; p->next = p; for(i = 1; i < 5; i++) { q = (struct node *)malloc(sizeof(struct node)); q->num = key[i]; q->next = p; } for(i = 0; i < 5; i++) { printf("%d ",q->num); q = q->next; } }