Bonsoir!

je suis en ce moment sur la manipulation des listes chaines et je n'arrive pas a inverser la liste, je n'arrive meme pas a demarrer je sait seulement que c'est un jeu de pointeurs pouvez vous m'eclairer?
voici le 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
 
typedef struct s_list
{
  char *data;
  struct s_list *next;
}              t_list;
 
int	my_put_in_list(t_list **begin, char *data)
{
  t_list	*new_elem;
 
  new_elem = malloc(sizeof(*new_elem));
  new_elem->data = data;
  new_elem->next = begin;
  *begin = new_elem;
}
void	my_putchar(char c)
{
  write(1, &c, 1);
}
 
void	my_putstr(char *str)
{
  while (*str)
    my_putchar(*(str++));
}
 
int	my_rev_list(t_list **begin)
{
  while (begin != 0)
    {
     ???????? 
    }
}
 
int	my_show_str_list(t_list *begin)
{
  while (begin != 0)
    {
      my_putstr(begin->data);
      my_putchar('\n');
      begin = begin->next;
    }
}
int	main(int ac, char **av)
{
  int	x;
  t_list	*begin;
 
  begin = 0;
  x = 1;
  while (ac > 0)
    {
      my_put_in_list(&begin,av[x++]);
      ac--;
    }
  return (0);
}
merci encore!