void reverse( node * & s)
{
// NOTE: YOU CAN NOT MOVE DATA FROM ONE NODE TO ANOTHER
// YOU CAN ONLY MOVE POINTERS FROM ONE NODE TO ANOTHER
// Grab the first node`
// Create
startNode = s;
node *guest,*secondT oLast,*secondEl em;
guest=secondToL ast=s;
// Return true if list is only 1 element long
if (s->next == NULL)
return true;
// Grab the second element in the list
secondElem = s->next;
// Grab the second to last element in the list
while(guest->next!=NULL)
{
secondToLast=gu est;
guest=guest->next;
}
// Set the second to last node to now point to the original first node
secondToLast->next=startNode ;
guest->next=secondEle m;
return true;
{
// NOTE: YOU CAN NOT MOVE DATA FROM ONE NODE TO ANOTHER
// YOU CAN ONLY MOVE POINTERS FROM ONE NODE TO ANOTHER
// Grab the first node`
// Create
startNode = s;
node *guest,*secondT oLast,*secondEl em;
guest=secondToL ast=s;
// Return true if list is only 1 element long
if (s->next == NULL)
return true;
// Grab the second element in the list
secondElem = s->next;
// Grab the second to last element in the list
while(guest->next!=NULL)
{
secondToLast=gu est;
guest=guest->next;
}
// Set the second to last node to now point to the original first node
secondToLast->next=startNode ;
guest->next=secondEle m;
return true;
Comment