finished c version of linked list