typedef struct node{
char name[10];
struct node *next;
}
int delete(struct node *book);
int main(){
struct node* head = (node*)malloc(sizeof(node));
head->next = NULL;
delete(head)
return 0;
}
int delete(struct node *book) {
char del_name[10];
struct node *curr = book->next;
struct node *curr2 = ( node*)malloc(sizeof( node));
curr2->next = curr;
printf("»èÁ¦ÇÒ À̸§:");
scanf("%s", del_name);
while (curr != NULL) {
if (strcmp(curr->name,del_name) == 0) {
curr2->next = curr->next;
printf("%s", curr->name);
free(curr);
}
else {
curr = curr->next;
curr2->next = curr;
}
}
}
¿¬°á¸®½ºÆ® ¾È¿¡ ³»¿ëÀº regist ÇÔ¼ö·Î Á¤»óÀûÀ¸·Î ÀÔ·ÂÇØ¼ ÀÌ»ó¾ø°í,
±×ÀÌÈÄ¿¡ ¿¬°á¸®½ºÆ® ¾È¿¡ ³»¿ëÁß ÀÔ·ÂÇÑÀ̸§ °ú °°Àº°æ¿ì »èÁ¦ÇÒ·Á°íÇϴµ¥ ¿¡·¯°¡¶ß³×¿ä
head -> node_1 -> node_2 -> NULL ÀÌ·¸°ÔµÇÀÖÀ¸¸é
head -> node_2 -> NULL ÀÌ·±½ÄÀ¸·Î ¸¸µé·ÁÇÔ