c - How to call in main a link list with argc and argv? -


how call in main function see if works ? don't know how call in main linked lists arguments seems more difficult .. please me ?

#include "ft_list.h"  t_list  *add_link(t_list *list, void *data) { t_list *aux;     aux = malloc(sizeof(t_list));     if (aux)     {         aux->data = data;         aux->next = list;     }     return (aux); }  t_list  *ft_list_push_params(int ac, char **av) { int i; t_list *list;      = 2;     if (ac == 1)         return (null);     list = ft_create_elem(av[1]);     while (i < ac)     {         list = add_link(list, av[1]);         i++;     }     return (list); }  int main(int argc, char**argv) { t_list *list;     list = ft_list_push_params(argc, argv);     return 0; } 

the line

        list = add_link(list, av[1]); 

should be

        list = add_link(list, av[i]); 

optional: ft_create_elem() not needed. add_link() can used push first node on empty list (list == null). i'm wondering if there should function display list, , function delete list (free allocated nodes). since nodes being pushed onto front of list, list end parameters in reverse order, wanted?


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

python - build a suggestions list using fuzzywuzzy -