UMBC CS 201, Fall 98
UMBC CMSC 201 & 201H Fall '98 CSEE | 201 | 201 F'98 | lectures | news | help

Keeping Linked List Information

The head node

When working with lists, there seem to be certain items of information about the list that is common. Some of these things are: It is quite common to have another type of struct that holds this information about the list. It can increasse efficiency in the program by always keeping a total of some data members, etc.

Here's an example:

/* nodePtr */ typedef struct tag *nodePtr; /* node */ typedef struct tag { int data; nodePtr next; }node; /* Struct to keep info about the list */ typedef struct dummy { int numNodes; int dataTotal; nodePtr head; nodePtr tail; } listInfo;


CSEE | 201 | 201 F'98 | lectures | news | help

Saturday, 28-Nov-1998 10:20:03 EST