home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_02_09
/
2n09016a
< prev
next >
Wrap
Text File
|
1991-07-31
|
706b
|
33 lines
/*
* A C-style linked list structure definition
*/
struct name_list_t {
char name[61];
char addr[101];
struct name_list_t *next;
struct name_list_t *prev;
};
struct name_list_t *name_top; /* head of list */
struct name_list_t *name_bot; /* end of list */
/*
* A code fragment that adds an entry to a linked list.
*/
struct name_list_t *entry;
entry = (struct name_list_t *)malloc(sizeof(name_list_t));
strcpy(entry->name, new_name);
strcpy(entry->addr, new_addr);
if (name_top = NULL)
name_top = entry;
if (name_bot ! = NULL)
name_bot -> next = entry;
entry->prev = name_bot;
entry->next = NULL;
name_bot = entry