// Program to traverse a linked list

#include <stdio.h>
typedef struct entry
{
     int            value;
     struct entry   *next;
}Entry;

void print_list (Entry *ptr);
int main (void)
{
     

     Entry   n1, n2, n3;
     //list_pointer used to iterate through the list.
     Entry   *list_pointer = &n1;

     /*This puts three entries in our list*/

     n1.value = 100;
     n1.next  = &n2;

     n2.value = 200;
     n2.next  = &n3;

     n3.value = 300;
     n3.next  = NULL;    // Mark list end with null pointer

     print_list(list_pointer);
     /*
     while ( list_pointer != NULL ) {
          printf ("%i\n", list_pointer->value);
          list_pointer = list_pointer->next;
     }
     */
     return 0;
}

void print_list(Entry *ptr)
{
     while (ptr != NULL)
     {
          printf ("%i\n", ptr->value);
          ptr = ptr->next;
     }
}