I'm stuck on this problem. I've been trying for days figuring out how to fix it. I have a linklist.. I want to sort it alphabetically, i'm almost there but the functionnn has a few bugs:

The output for the following code:

Androd
Dog
Bat


as you can see... the last element comes before alphabetically before the previous one my sort method does not handle it. Does anyone know how to fix this? (the code in bold indicates where the problem is)

Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct charNode
{
   char petName[12];

   struct charNode *next;
};

typedef struct charNode charNode;

void addElement(charNode **start, char *petName);
void printList(charNode *start);
charNode* newNode(char *petName);
void getString(charNode *start);
charNode *sort(charNode *start);
charNode *reverse(charNode *head);

int main()
{
   charNode *start = NULL;

   getString(start);
  
   return 0;
}


void getString(charNode *start)
{


   addElement(&start, "Dog");
     addElement(&start, "Androd");
     addElement(&start, "Bat");  

     start = sort(start);
     printf("\n");
     printf("\n");
       printList(start);

}

void addElement(charNode **start, char *petName)
{

   charNode *temp,*prev, *loc;
   int i;

   temp = newNode(petName);


   if (*start == NULL)
   {
      *start = temp;
   }

   else
   {
      loc = *start;
      prev = NULL;

       for (i=0; loc != NULL; i++)
       {
   
           	prev = loc;
			loc = loc->next;
        }
	      if (prev == NULL)
         {     
            *start = temp;
         }
         else
         {
            prev->next = temp;  
         }
   }
  

}

charNode* newNode(char *petName)
{

   charNode *temp;

   temp = (charNode *) malloc(sizeof(charNode));
   if (temp == NULL)
   {
      printf("WARNING - Memory allocation error\n");
      exit(EXIT_FAILURE);
   }


  strcpy(temp->petName, petName);


   temp->next = NULL;

   return temp;
}


void printList(charNode *start)
{

   while (start != NULL)
   {

      printf("%s\n", start->petName);
      start = start->next;
   }
}
charNode *sort(charNode *start)
{

   charNode *temp = NULL;
   charNode *prev = NULL;
   charNode *current = start;

   if (start!=NULL)
   {
      if (start->next != NULL)
      {
         prev = start;
         current = start;

         while (current != NULL)
         {
            if ( strcmp(current->petName, start->petName) <0)
            {
               prev->next = current->next;     
               temp = start;      
               start = current;      
                                     
               start->next = temp;   
            }
         
            else
               prev = current;
               current = current->next;
         }
      }
   }
   return start;
}