Commit 7f41a522 authored by William Sha's avatar William Sha
Browse files

Implemented (for real) insert_empty_function

parent 587fa942
......@@ -44,13 +44,19 @@ void insert_empty_list(List** list, char* str){
while(length > 0 && i < 5){ // tant qu'il reste de l'input et que l'on a pas rempli la data
*(e->data+i) = *(str+total+i);
i++;
length--;
}
if(i!= 5){
*(e->data+i) = '\0';
}
total += i;
e->next = NULL;
(*list)->head = e;
if (!(*list)->head)
(*list)->head = e;
else
(*list)->tail->next = e;
(*list)->tail = e;
if (DEBUG) printf("element while : %s\n", e->data);
}
if (DEBUG) printf("FLAG 2\n");
......@@ -135,7 +141,7 @@ void display(List* list){
}
Element *p = list->head;
for (p = list->head; p != NULL; p = p->next){
printf("element: %s\n ", p->data);
printf("element: %s\n ", p->data);
}
//printf("DATA : %c", list->head->data[0]);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment