This is how you create a new employee struct. You are dynamically allocating the memory using malloc function.
struct employee *new_employee = (struct employee*)malloc(sizeof(struct employee));
Now, we need to fill the data into this newly created employee field:
new_employee -> id = input_id;
new_employee -> age = input_age;
As for the next pointer, it is usually given NULL value. This is to prevent the next pointer from pointing to any arbitrary memory location.
new_employee -> next = NULL;
Finally, we have to link the list. To do that, you have to point the next pointer of the previous employee field to the current employee field (ex:as you mentioned in comment, first one (9,3) having a next pointer to the second one (3, 2))
Since it is a singly linked list, we cannot backtrack. So, there are two methods to access the previous field.
First is to maintain a pointer that points to the last field of the link list.
Second is to traverse the entire list till the end, and when you reach the last element, change its next pointer.
Implementation of the second method:
node *temp = *start;
if(temp!=NULL)
{
while(temp -> next)
temp = temp -> next;
temp -> next = new_employee;
}
Hope it helps!