Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

How can I write a reverse void function that has onecall by refrence parameter t

ID: 3615961 • Letter: H

Question

How can I write a reverse void function that has onecall by refrence parameter thatreverses the list of integers. I'm almostdone with my project, but stuck in this part.
and please see if there is any more functions needed

here is my header file:
namespace stacksavitch
{
   struct stackFrame
   {
       int data;
       stackFrame *link;
   };
   typedef stackFrame* stackFramePtr;

   class stack
   {
   public:
       stack();
       stack(conststack&a_stack);
       ~stack();
       void push (intthe_number);
       int pop();
       bool empty()const;
void head_insert(stackFramePtr& head, int the_number);
void reverse(&head);


   private:
       stackFramePtr top;
   };
}



Explanation / Answer

please rate - thanks stackFramePtr is a "pointer" already so I believe it's considered areference parameter namespace stacksavitch {     struct stackFrame     {         int data;         stackFrame *link;     };     typedef stackFrame* stackFramePtr;     class stack     {     public:         stack();         stack(conststack&a_stack);         ~stack();         void push (intthe_number);         int pop();         bool empty()const; void head_insert(stackFramePtr& head, int the_number); void reverse(stackFramePtr);     private:         stackFramePtr top;     }; } void reverse( stackFramePtr head ) { Stack stack; stackFramePtr temp; temp = head; while ( NULL != temp ) {     stack.push( temp->value);     temp = temp->link; }     temp = head; while ( NULL != temp ) {     temp->value = stack.pop();     temp = temp->link; } }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote