Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6567643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:21:43+00:00 2026-05-25T14:21:43+00:00

I had a certain query regarding a question I was asked earlier. I was

  • 0

I had a certain query regarding a question I was asked earlier.

I was given this function prototype void StackPop(NodeType *Top) and was told modify the top of the stack without access to the stack object. StackPop function here is a global function and not a member function of the Stack class. After popping, Top should point to the new value of Top element.

As a solution, popping the top of the stack in such a case would only be possible if we pass the address of the top node of the stack to the function while calling. eg: StackPop(&address);
To modify the top of the stack

NodeType* temp;
temp = top;
*top = (*top)->next;
delete temp;

Is this the simple answer to the question or is something else the case that has to be taken care of?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T14:21:43+00:00Added an answer on May 25, 2026 at 2:21 pm

    Yes, this is a valid simple answer to the question, with three caveats:

    1. temp = top should read temp = *top;
    2. you might want to gracefully handle the case where *top is NULL (rather than just dereferencing the NULL pointer);
    3. this solution is of course incompatible with the prototype you were given [void StackPop(Node *Top)] as it would take Node** as its argument.

    The only other remark that I have is that StackPop sounds like it ought to be a member function rather than a free function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

just had a general question about how to approach a certain problem I'm facing.
I've had a good look around and am certain that there's no matching question
I've had this same question when working with different templating systems in different languages
I am new to Spring MVC. But I had certain experience in working with
I had a need for a certain functionality on my web apps and I
I had an application for returning closest matches to certain values in a large
As a mostly self-taught programmer, I have never really had anyone explain why certain
Had a coworker ask me this, and in my brain befuddled state I didn't
I have to build a query based on certain conditions. Is there a better
This post is intended to be less of a question and more a confirmation

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.