Salut a tous,

jessaye de trier une liste chainee avec ce code
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
int     sort_in_list(t_list *begin)
{
  char          *str;
  t_list        *i;
  t_list        *j;
  t_list        *b;
 
  i = begin;
  while(i->next != 0)
    {
      j = begin;
      while (j->next != 0)
        {
          if (my_strcmp(j->next->data, j->data) < 0)
            {
              str =j->data;
              j->data = j->next->data;
              j->next->data = str;
            }
          j = j->next;
        }
      i = i->next;
    }
  return (0);
}
le probleme c'est quand jappelle la fonction
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
sort_in_list(begin)
j->next->data est vide et j->data contient le dernier element inserer dans la liste
Dou ma question comment remettre begin a son orirgine