La swap deve essere

codice:
void swap(char **a, char **b)
{
     char *papp;

     papp=*a;
     *a=*b;
     *b=papp;
}
Controlla tu il perche' ...