Commit 673fa3f5 authored by Lenitra's avatar Lenitra
Browse files

pusheeuuu

parent ca7d1d8a
Loading
Loading
Loading
Loading
+13 −10
Changes for src/list.c: 13 added lines, 10 removed lines.
Original line number Diff line number Diff line
@@ -18,16 +18,19 @@ int list_is_empty(list_t l){

list_t list_push(list_t l, void* x){
  // add x to the end of l
  list_t c = malloc(sizeof(*c));
  c -> val = x;
  if(list_is_empty(l)){
    c -> id = 1;
    c -> next = NULL;
  } else {
    c -> id = l -> id + 1;
    c -> next = l;
  }
  return c;
  list_t new = malloc(sizeof(struct cell_t));
  new->val = x;
  new->id = 0;
  new->next = NULL;
  if(l == NULL){
    return new;
  }
  list_t tmp = l;
  while(tmp->next != NULL){
    tmp = tmp->next;
  }
  tmp->next = new;
  return l;
}

list_t list_tail(list_t l){