#include <stdio.h>

 #include <string.h>

 #include <memory.h>

 #define YES 1

 #define NO 0

 #define LIST struct list

 LIST {

    char *name;

    char *tel;

    LIST *next;

 };

 LIST *node(LIST *rp, char *nnam, char *ntel);

 int inp(char *inam, char *itel);

 LIST *nalloc();

 char *strsv(char *s1);

 void prn(LIST *pp);

 LIST *srch(LIST *sp, char *snam);

 LIST * modi(LIST *mp, char *mnam);

 LIST *dele(LIST *dp, char *dnam);

 main()

 {

    LIST *root, *node(), *srch(), *modi(), *dele();

    char name[15], te1[15];

    char cname[15];

    int key;

    root = NULL;

    do {

       printf("\n\n input-1 display-2 search-3 update-4 delete-5 end-6 \n");

       printf("\n key -->");

       scanf("%d", &key);

       if (key == 1) {

          printf("\n ------------- input ----------- \n");
          while (inp(name, te1) == NO)
          root = node(root, name, te1);

       }

       if (key == 2) {

          printf("\n ------- disply --------- \n");

          printf("\nname te1 \n\n");

          prn(root);

       }

       if (key == 3) {

          printf("\n --------- search ---------- \n");

          printf(" name --> ");

          scanf("%s", cname);

          srch(root, cname);

       }

       if (key == 4) {

          printf("\n --------- update ---------- \n");

          printf(" name --> ");

          scanf("%s", cname);

          modi(root, cname);

       }
       if (key == 5) {
          printf("\n --------- delete ---------- \n");

          printf(" name --> ");

          scanf("%s", cname);

          dele(root, cname);

       }

       if (key == 6) {

          printf("\n --------- end ---------- \n");

       }

    } while (key < 6);

 }

 LIST *node(LIST *rp, char *nnam, char *ntel)

 {

    LIST *nalloc();

    //char *strsv();

    int cmp;

    if (rp == NULL) {

       rp = nalloc();

       rp->name = strsv(nnam);

       rp->tel = strsv(ntel);

       rp->next = NULL;

    }

    else if ((cmp = strcmp(nnam, rp->name)) == 0) {

       printf("\n ----------------------------------------------\n");

       printf("     NAME = %-15s TEL = %-13s \n", rp->name, rp->tel);

       printf("\n ----------------------------------------------\n");

    }

    else

    rp->next = node(rp->next, nnam, ntel);

    return(rp);

 }

 int inp(char *inam, char *itel)

 {

    printf("\n -------------------------------- \n");

    printf("\n -----IF name is q then exit..--- \n");

    printf("\n -------------------------------- \n");

    printf("\n name --> ");

    scanf("%s", inam);

    if (*inam == 'q' || *inam == 'Q')

    return(YES);

    printf("\n tel --> ");

    scanf("%s", itel);

    return(NO);

 }

 LIST *nalloc()

 {

    char *malloc();

    return(LIST*) malloc(sizeof(LIST));
 }

 char *strsv(char *sl)

 {

    char *p, *malloc();
    if ((p = malloc(strlen(sl) + 1)) !=NULL)

    strcpy(p, sl);

    return(p);
 }

 void prn(LIST *pp)

 {

    if (pp !=NULL) {

       printf("%-13s s \15s \n", pp->name, pp->tel);

       prn(pp->next);

    }

 }

 LIST *srch(LIST *sp, char *snam)

 {

    int cmp;

    if ((cmp = strcmp(snam, sp->name)) == 0) {

       printf("\nname                  te1 \n\n");

       printf("%-13s s \n", sp->name, sp->tel);

    }

    else

    sp->next = srch(sp->next, snam);

    return(sp);

 }

 LIST *modi(LIST *mp, char *mnam)

 {

    char mte1[15];

    int cmp=1;

    if ((cmp = strcmp(mnam, mp->name)) == 0) {

       printf(" te1 --> ");

       scanf("%s",mte1);

       strcpy(mp->name, mnam);

       strcpy(mp->tel, mte1);

    }

    else

    mp->next = modi(mp->next, mnam);

    return(mp);

 }

 LIST *dele(LIST *dp, char *dnam)

 {

    int cmp=1;

    LIST *p;

    if ((cmp = strcmp(dnam, dp->name)) == 0) {

       p=dp->next;

       free(dp);

       return(p);

    }

    else
    dp->next = dele(dp->next, dnam);

    return(dp);

 }




이렇게 뜨는데



1>------ 빌드 시작: 프로젝트: ohg, 구성: Debug Win32 ------
1>  sdfgdsfg.cpp
1>c:\users\으앜\documents\visual studio 2010\projects\ohg\ohg\sdfgdsfg.cpp(41): error C4430: 형식 지정자가 없습니다. int로 가정합니다. 참고: C++에서는 기본 int를 지원하지 않습니다.
1>c:\users\으앜\documents\visual studio 2010\projects\ohg\ohg\sdfgdsfg.cpp(195): error C2660: 'malloc' : 함수는 1개의 매개 변수를 사용하지 않습니다.
1>c:\users\으앜\documents\visual studio 2010\projects\ohg\ohg\sdfgdsfg.cpp(203): error C2660: 'malloc' : 함수는 1개의 매개 변수를 사용하지 않습니다.
1>c:\users\으앜\documents\visual studio 2010\projects\ohg\ohg\sdfgdsfg.cpp(286): error C3861: 'free': 식별자를 찾을 수 없습니다.
========== 빌드: 성공 0, 실패 1, 최신 0, 생략 0 ==========