bool CharacterList::addCharacter(Character *newCharacter)
{
    Character *temp, *back;
    if(head == NULL)
    {
        head = newCharacter;
    }
    else
    {
        temp = head;
        back = NULL;
        while((temp != NULL) &&  (temp < newCharacter))
        {
            back = temp;
            temp = temp.next;
        }
        if(back == NULL)
        {
            newCharacter.next = head;
            head = newCharacter;
        }
        else
        {
            back.next = newCharacter;
            newCharacter.next = temp;
        }
        return true;
    }
}
I'm creating an ordered linked list(CharacterList) for the objects of class Character. This function will take only one argument, a pointer to a Character class object(*newCharacter). It will then add this character to the linked list of character objects. I'm not sure if this is how I insert an object to the linked list. can someone guide me please ?
 
     
    