All pastes #499295 Raw Edit

Anonymous

public c v1 · immutable
·published 2007-05-21 00:13 UTC
rendered paste body
node* reverse(node* list){  node* backward = list;  node* previous;  //If list is empty, do not return anything.  if(list == NULL)    return list;  //Base case which assigns the last node and the next of that to NULL.  if (list->next == NULL){    previous = backward->next;    list = backward;    return list;  }  //Recusive part that reverses each value as it moves to the next in list.  else{    previous = backward->next;//Previous value is set to the next of backward.    return reverse(previous);//Calls on function to loop back.  }}