#include <stdio.h>
#include <stdlib.h>
int main(void)
{
    int i = 0;
    struct link_list
    {
            int num;
            struct link_list *next;
    };
    
    struct link_list mylist;
    struct link_list *myptr;
    
    myptr = &mylist;
    myptr->next = NULL;
    
    for(i = 0; i < 10; i++)
    {
          myptr->num = i;
          myptr->next = (struct link_list *)malloc(sizeof(struct link_list));
          myptr = myptr->next; 
          myptr->next = NULL;
    }
    
    myptr = &mylist; 
    while(myptr->next)
    {
                printf("%d\n", myptr->num);
                myptr = myptr->next;
    }

    system("pause");
    return 0;
}