Code: void SinglyLinkedList::reverse() { /******************** Node* currentFirst; Node* currentLast; currentFirst=first_ptr; *********************** if(first_ptr==NULL||first_ptr->next==NULL) return; Node*current=first_ptr->next; Node *pervious=first_ptr; Node*after; first_ptr->next=NULL; while(current!=NULL) { after=current->next; current->next=pervious; pervious=current; current=after; } first_ptr=pervious; *********************/ /**********other way**********/ if(first_ptr==NULL||first_ptr->next==NULL) return; Node*current=first_ptr->next; //Node *pervious=first_ptr; Node*newNode=NULL; first_ptr->next=NULL; while(current!=NULL) { newNode=current->next; current->next=first_ptr; first_ptr=current; current=newNode; } //first_ptr=pervious; /*********************************/ }