Thanks for the replies.At this point I need bit more effective. Am I on the right right track, if I am not can you put me on the right track?
I am getting
Code:
list.c:59: warning: passing arg 2 of `__builtin_strcmp' from incompatible pointer type
list.c:59
Code:
while(strcmp(previous, new_node ) > 0 && strcmp(current, new_node) < 0)
Rest of the codes:
Code:
void insert_in_order(char *n, node_ptr list)
{
node_ptr previous = list;
node_ptr current = list->next;
node_ptr new_node = (node_ptr)malloc(sizeof(struct node));
new_node->name = n;
if(current == NULL)
{
new_node->next = list->next;
list->next = new_node;
}
while (current != NULL)
{
while(strcmp(previous, new_node ) > 0 && strcmp(current, new_node) < 0)
{
previous->next = new_node;
new_node->next = current;
break;
}
previous = current;
current = current->next;
}
}