Linked Lists 141
83 };
84 // display data block
85 void display_data(DataT
*
pblock) {
86 printf("Data: %s %d %d \n", pblock->name,
87 pblock->age, pblock->jobcode);
88 }
89 void traverse_display (listT
*
plist) {
90 printf("Traverse and display data: %s \n", plist->lname);
91 int i;
92 DataT
*
lblock;
93 if (plist->numnodes <= 0 )
94 return;
95 lblock = get_front(plist); // get first data block
96 display_data(lblock);
97 for (i=2; i <= plist->numnodes; i++) {
98 lblock = get_next(plist); // get next data block
99 display_data(lblock);
100 }
101 }
In line 12 of the source program, a structure is defined as the data block that
the program uses to store data. The required name of the structure is Datablock
and the form of the structure may vary. Each of these data blocks ...