노드1 [자료구조] by C언어 #12 [연결리스트] ㅡㅡㅡㅡㅡ #include #include //연결리스트를 구현할 구조체 typedef struct NODE{ int data; struct NODE* next; }node; int main(void) { node* head = (node*)malloc(sizeof(node)); // 헤드(시작)노드 생성 head->next=NULL; // 머리 노드의 next값은 NULL이다. // 노드연결 node* node1 =(node*)malloc(sizeof(node)); // 노드생성. node1->next = head->next; //노드연결. // node1의 다음주소는 머리노드가 가리키던 다음주소(NULL)를 저장. node1->data =10; // node1의 데이터에는 10을 저장. head->n.. 2021. 4. 9. 이전 1 다음 728x90