일이 코딩 시험인데ㅠㅠㅠ 


연결리스트도 못만드는 븅신이라 살려주셈ㅠㅠㅠㅠ





자꾸 이런 에러가 뜨는데 왜 동적할당도 안될까???


#include <stdio.h>

#include <stdlib.h>


#define Element char

#define bool unsigned char

#define true 1

#define false 0


typedef struct list_node *list_pointer;

typedef struct list_node {

Element data;

struct list_node *link;

}list_node;

list_pointer p;


void list_insert(list_pointer head, Element e){

p = (list_pointer*)malloc(sizeof(list_node));

p -> >

p -> link = NULL;

head -> link = p;

}

void list_delete(list_pointer head, Element e){

int node=0, next=0;

if(head == NULL){

printf("list is empty");

}

else{

while(p->link = NULL){

if(p-> e {

node = &p;

next = p->link;

}

p = p->link;

}

p = head;

while(p->link){

if(p->link == node){

p->link = next;

}

p = p->link;

}

free(&node);

}

}


list_pointer list_search(list_pointer head, Element e){

int adrs=0;

tmp = head;

while(tmp == NULL){

if(tmp -> e {

printf("node address: %p\ndata : %c\nlink : %s\n", tmp, tmp->data,tmp->link );

}

else{

printf("%c is not in the list!!!", e);

}

tmp = tmp -> link;

}

}

bool list_empty(list_pointer head){


}

void list_show(list_pointer head){

if(head == NULL){

printf("List is empty!!!\n");

}

else{

p = head;

while( p-> link = NULL){

printf("%c ", p->data);

p = p -> link;

}

}

}


void main() 

{

char c, e;

list_pointer  head, tmp;

list_pointer p;

printf("*********** Command ***********\n");

printf("+<c>: Insert c, -<c>: Delete c\n");

printf("?<c>: Search c, S: Show, Q: Quit\n");

printf("********************************\n");


// dummy head 노드 

head = (list_pointer*)malloc(sizeof(list_node));

head-> ';   

head->link = ' ';  

while (1) {

printf("\nCommand> ");

c = getchar();

putch(c);

c = toupper(c);

switch (c) {

            case '+' : 

  e = getchar();

                list_insert(head, e); break;

            case '-' : 

  e = getchar();

                list_delete(head, e); break;

            case '?' : 

                e = getchar();

                p = list_search(head, e); 

                break;

            case 'S' : 

                list_show(head); break;

            case 'Q' : 

                printf("\n");

exit(1);

            default  :  break;

        }

    }

}



븅신좀 도와주셈