Tilbage til slide -- Tastaturgenvej: 'u'        næste -- Tastaturgenvej: 'n'          structures/lists.c - Funktionerne cons, head og tail.Lektion 12 - slide 26 : 36
Program 1

/* Returns a pointer to a new cons cell, 
   which refers data and next via pointers*/
cons_cell *cons(void *data, cons_cell *next){
 cons_cell *result;
 result = (cons_cell *)malloc(sizeof(cons_cell));
 if (result == NULL){
   printf("Out of memory. Bye.");
   exit(EXIT_FAILURE);
 }
   
 result->data = data;
 result->next = next;
 return result;
}

/* Return the head reference of the cons cell */
void *head(cons_cell *cell){
  return cell->data;
}

/* Return the tail refererence f the cons cell */
cons_cell *tail(cons_cell *cell){
  return cell->next;
}