#include <stdio.h>
#include <stdlib.h>

typedef struct address
{
 int id;
 char Name[16];
 int Age;
 char Tel[15];
 char Addr[64];
 address *next;
 address *prev;
}address;

address *head;

void makefirst()
{
 head = (address *)malloc(sizeof(address));
 head->prev = NULL;
 head->next = NULL;
}

void makerightaddress(address *target, address *aNode)
{
 address *New;
 address *right;
 
 New = (address *)malloc(sizeof(address));
 *New = *aNode;

 printf(\"id를 입력하세요 : \");
 scanf(\"%d\", &aNode->id);
 printf(\"이름을 입력하세요 : \");
 scanf(\"%s\", aNode->Name);
 fflush(stdin);
 printf(\"나이를 입력하세요 : \");
 scanf(\"%d\", &aNode->Age);
 fflush(stdin);
 printf(\"전화번호를 입력하세요 : \");
 scanf(\"%s\", aNode->Tel);
 fflush(stdin);
 printf(\"주소를 입력하세요 : \");
 scanf(\"%s\", aNode->Addr);
 
 right = target->next;
 New->next = right;
 New->prev = target;
 target->next = New;
 if(right)
 {
  right->prev = New;
 }
}

void makeleftaddress(address *target, address *aNode)
{
 address *Left;

 Left = target->prev;
 if(Left)
 {
  makerightaddress(Left, aNode);
 }
}


void AppendNode(address *aNode)
{
 address *tail;

 for(tail = head ; tail -> next ; tail = tail ->next)
 {;}
 makerightaddress(tail, aNode);
}
void main()
{
 int i;
 address *Now, Temp;
 makefirst();
 for(i = 0 ; i < 5 ; i++)
 {
  AppendNode(&Temp);
 }

 for(Now = head -> next ; Now ; Now = Now->next)
 {
  printf(\"id : %d\\n\", Now->id);
  printf(\"이름 : %s\\n\", Now->Name);
  printf(\"나이 : %d\\n\", Now->Age);
  printf(\"전화번호 : %s\\n\", Now->Tel);
  printf(\"주소 : %s\\n\", Now->Addr);
  printf(\"-----------------------\\n\");
 }
 printf(\"\\n\");
}

이중연결리스트이기는 한데 막상 main에서는 그냥 연결리스트 처럼 사용했는데, 출력해보니까 처음값이 쓰레기값투성이로 나오네요 ㅜㅜ

어떻게 된거죠??? ㅜㅜ