[prev] [index] [next]

List Type

In the previous examples, we define a list
  • using a pointer to the first node in the list
Thus, a common typedef for a list type is:

typedef struct node {
	int data;
	struct node *next;
} NodeT;

typedef NodeT *List;

The previous functions could then be defined as:

void printList(List list) { ... }
int length(List list) { ... }