Basic implementation of linked lists using pointers