how do you insert in linked list. this is that i have.
struct node
{
int data;
struct node *next;
}; struct node *head;
void insert(struct node*, char*, int);
int main()
{
int data;
struct node *List_A = NULL;
insert(&List_A, %data);
return 0;
}
void insert(struct List_A, int data)
{
struct node * new_node;
if(List_A == NULL)
{
head = ...malloc...;
head->data = data;
}
else
{
while(List_A != NULL)
{
List_A = List_A->next;
}
new_node = ... malloc...;
new_node->data = data;
new_node->next = NULL;
List_A->next = new_node;
}
}