Now I'm meant to implement a function to "doublify" a linked list. That is, a single linked list with the structure only containing a next pointer is to be modified so that it will have a pointer to "previous" as well. And to take a single linked list and implement the previous pointer.

I did it without looking at the solutions posted by my lecturer, and after I finished, I looked the lecturer's code. I got rather confused, my code was a rather simple (well it seemed like it) bit of code to do, it's just the bit in red, the following bit is just testing to see if it was done. While my lecturer's was a nightmare to follow

Code:
link doublify (link l) {
  
  char c;

  link current = l;
  link temp = l;

  while(current->next != NULL) {
    current = current->next;
    current->prev = temp;
    temp = temp->next;
  }
  current = l;

  while ((c = getchar()) != EOF) {
  switch (c) {
    
    case 'n':
      if(current->next != NULL) {
        current = current->next;
        printf("%c\n", current->item);
      }
      else if(current->next == NULL) {
        printf("No next node, going back to head\n");
        current = l;
      }
      break;
    
    case 'p':
       if(current->prev != NULL) {
         current = current->prev;
         printf("%c\n", current->item);
       }
       else if(current->prev == NULL) {
         printf("No prev node, going back to head\n");
         current = l;
       }
       break;
     
     case 'e':
       return 0;
       break;

     }
  }

  return (l);
}
Now here's the lecturer's solution:

Code:
link doublify (link l)
{
  link t,
    new = NULL,
    nextPrev = NULL;
  link *linkPtr = &new;

  while (l != NULL) {
    t = (link) malloc (sizeof *t);
    t->item = l->item;
    t->prev = nextPrev;
    t->next = NULL;
    nextPrev = t;
    *linkPtr = t;
    linkPtr = &(t->next);
    l = l->next;
  }
  return new;
}
Whilst I am sure I could understand it if I spent 30 minutes drawing up his method, since my method seemed to work for me, I don't see why his method is so complicated? Is my method wrong?