본문/내용
리스트의 노드수를 계산하는 함수 length를 작성하라.
#include
#include
/* 리스트 노드 구조체 :
데이터와 노드 포인터를 가진다.
*/
typedef struct list_node *list_pointer;
typedef struct list_node{
int data;
list_pointer link;
} list_node;
// 함수 원형들을 선언
int length(list_pointer p);
void print_list(list_pointer p);
void create_node(list_pointer *p);
void list_delete(list_pointer p);
/* 메인함수 :
리스트의 추가, 삭제, 프린트와 길이 계산 가능
*/
void main()
{
// 메뉴 선택을 위한 변수
int c;
// 리스트의 길이를 헤아리기 위한 변수
int count;
// 리스트의 최상위 포인터
list_pointer ptr = NULL;
while (1)
{
.....