#include /* definitions and prototypes for calloc() below */ #include /* definitions and prototypes for printf() below */ /* definition of list item structure */ struct Item_t { double data; struct Item_t * next; }; /* define type for later convenience usint the item structure */ typedef struct Item_t Item; static Item * makeItem( double data ) { Item * item = (Item *)calloc( 1, sizeof( Item ) ); item->data = data; return item; } int main() { Item *first = makeItem( 0 ), *prev = first, *item; int i; for( i = 0; i < 20; i++ ) { item = makeItem( i + 1 ); prev->next = item; prev = item; } for( item = first; item->next != NULL; item = item->next ) { printf( "item data: %f\n", item->data ); } return 0; }