오류좀 잡아주세요//9시30분까지 급합니다.
하양이
#include stdio.h
#include malloc.h
#include stdlib.h
#include conio.h
struct linked_list
{
struct data *elament;
struct linked_list *link;
};
struct data
{
char name[30];
char address[50];
char number[30];
}st1[20];
void add_node(struct data *input_data);
void print_linked_list(struct linked_list *now);
void print_reverse_linked_list(struct linked_list *now);
struct linked_list *head;
int main(void)
{
int count=0;
char key;
head = (struct linked_list*)malloc(sizeof(struct linked_list));
head-link=NULL;
do
{
count++;
printf(%2d번 이름입력 ,count);
scanf(%s, &st1[count].name);
printf(%2d번 주소입력 ,count);
scanf(%s, &st1[count].address);
printf(%2d번 전화번호입력 ,count);
scanf(%s, &st1[count].number);
add_node(st1);
printf(%c \n, key);
}while(key!=27);
printf(\n\n);
printf(입력된 순서 : );
print_linked_list(head-link);
printf(\n);
printf(입력의 역순 : );
print_reverse_linked_list(head-link);
printf(\n);
return 0;
}
void add_node(struct data *input_data)
{
struct linked_list *new_node, *last;
last=head;
while(last-link != NULL)
last=last-link;
new_node = (struct linked_list*)malloc(sizeof(struct linked_list));
new_node-elament=data;
new_node-link=last-link;
last-link=new_node;
}
void print_linked_list(struct linked_list *now)
{
while(now!=NULL)
{
printf(%c , now-elament);
now=now-link;
}
printf(\n);
}
void print_reverse_linked_list(struct linked_list *now)
{
if (now-link!=NULL)
{
print_reverse_linked_list(now-link);
printf(%c , now-elament);
}
else
printf(%c , now-elament);
}
이름,주소,전화번호를 입력받고
그걸 역순으로 출력하는건데... 에러가 하나뜹니다..
부탁드려요 9시30분까지요..