typedef struct node1* Node;

struct node1{

int num;

Node next;

};


void insert(Node, int);


int main() {

Node head = (Node)malloc(sizeof(struct node1));


for (int i = 1; i <= 5; i++) {

insert(head, i);

}


Node curr = head->next;

while (1) {

printf("%i", curr->num);

curr = curr->next;

}


return 0;

}


void insert(Node head, int data) {

Node list = (Node)malloc(sizeof(struct node1));

if (head == NULL) {

list->num = data;

list->next = list;

head = list;

}

else {

list->num = data;

list->next = head->next;

head->next = list;

}

}