Toggle navigation
Home
Latest pastes
FAQ
Random
BitBin is shutting down!
Register
Login
Untitled
SUBMITTED BY:
Guest
DATE:
Oct. 21, 2014, 8:28 p.m.
FORMAT:
Text only
SIZE:
1.4 kB
Raw
Download
Tweet
HITS:
857
Go to comments
Report
#include <stdlib.h>
//#include "mylist.h"
typedef struct s_list
{
void *data;
struct s_list *next;
} t_list;
void my_putchar(char c)
{
write(1, &c, 1);
}
int my_putstr(char *str)
{
int i;
i = 0;
while (str[i] != '\0')
{
my_putchar(str[i]);
i++;
}
return (str[i]);
}
int my_show(t_list *dbt)
{
while (dbt != 0)
{
my_putstr(dbt->data);
my_putchar('\n');
dbt = dbt->next;
}
return (0);
}
int my_put_in_list(t_list **dbt, char *data)
{
t_list *new_elem;
new_elem = malloc(sizeof(*new_elem));
if (new_elem == NULL)
return (0);
new_elem->data = data;
new_elem->next = *dbt;
*dbt = new_elem;
return (0);
}
t_list *my_params_in_list(int ac, char **av)
{
t_list *dbt;
int i;
dbt = 0;
i = 0;
while (i < ac)
{
my_put_in_list(&dbt, av[i]);
i++;
}
return (dbt);
}
int main(int ac, char **av)
{
t_list *test;
t_list **test2;
test = my_params_in_list(ac, av);
test2 = &test;
my_show(test);
return (0);
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus