my_params_in_list.c


SUBMITTED BY: Guest

DATE: Nov. 29, 2013, 6:29 p.m.

FORMAT: C#

SIZE: 546 Bytes

HITS: 4481

  1. t_list *my_params_in_list(int ac, char **av)
  2. {
  3. int nb;
  4. struct s_list *list;
  5. nb = 0;
  6. list = NULL;
  7. while (nb < ac)
  8. {
  9. my_put_in_list(&list, av[nb]);
  10. nb = nb + 1;
  11. }
  12. return (list);
  13. }
  14. int my_put_in_list(struct s_list **list, void *data)
  15. {
  16. struct s_list *elem;
  17. elem = malloc(sizeof(*elem));
  18. if (elem == NULL)
  19. return (1);
  20. elem->data = data;
  21. elem->next = *list;
  22. *list = elem;
  23. return (0);
  24. }

comments powered by Disqus