Interview screwups

14 August 2009

list_t *reverse = 0;
while( list )
   {
   list_t *this = list;
   list = list->next;
   this->next = reverse;
   reverse = this;
   }
base = reverse;

Writing this using Xemacs with GCC at the ready is one thing. Writing it by hand as an algorithm rather than C code during an interview is something else. Needless to say I messed it up..