선형리스트 "listhead*"에 "listNode*"를 할당할수없다는 오류 도와주셨으면 합니다
두루
질문 내용 :
자유공간에서 공간얻을때는 listhead를 하고 특정데이터를 집어넣을려면 listNode를 쓸수밖에 없는데
저런 에러가 뜨는데 도와주셨으면 합니다.
#include stdio.h
#include stdlib.h//calloc
#include string.h//strcpy
typedef struct listNode //단순 연결 리스트의 노드 구조 정의
{
char data[10];
struct listNode* link;
} listNode;
typedef struct listhead//리스트의 시작점 //여기부터 노드가 시작된다// //
{
listNode* head;
} listhead;
listhead* getnode ()
{
int num=30;//30개의 자유 공간 리스트
listhead* nnode;
listhead* free=(listhead*)calloc(sizeof(int),num);
if (free == NULL)
printf(메모리를 할당받지 못했습니다\n);
nnode-head=free-head;
free-head=free-head-link;
return nnode;
}
listhead* oldnode(listhead* old)
{
listhead* free;
old-head-link=free-head;
free-head=old-head;
}
int insertfirstnode(int a)
{
listNode* add;
add=getnode();//자유노드에서 노드 할당받아옴
add=getnode()=a value of type listhead*cannot be assigned to an entity of type listNode*
}
int main()
{
int a=1,b=2,c=3;
insertfirstnode(a);//리스트의 첫번째 노드 삽입
}