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 624657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:13:27+00:00 2026-05-13T19:13:27+00:00

I am just wanting a simple explanation of the linking process when pushing data

  • 0

I am just wanting a simple explanation of the linking process when pushing data onto a stack. I know how to build on using the code from my book, but I am not really sure I understand how the process works when you move the stack head link from one to the next.

For stacks like:

typedef struct node
{
    void dataptr;
    struct node* link;
}STRUCT_NODE;

typedef struct
{
    int count;
    STACK_NODE* top;
}STACK;

How do you change the link to point to the new data pushed on the stack. Also I do not know

  • 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-13T19:13:27+00:00Added an answer on May 13, 2026 at 7:13 pm

    Stacks can be implemented in various ways, but given the way you phrase your question I’m assuming your stack is just a linked list, something like

    head
    ↓
    A → B → C → D → 0
    

    “when you move the stack head link from one to the next” the picture just changes to:

        head
        ↓
    A → B → C → D → 0
    

    Of course A is not reachable any more in this graph, so you’d better have another pointer to it somewhere (be it only to dispose of it), but this is the gist how how the stack is popped (by making head = head->next if each node in the stack is a struct node with a next field that’s a struct node*, and of course head is a struct node* as well).

    That’s for popping something off the stack (and you should free the memory used by A in that case). In detailed steps, it would be:

    1/ Saving the old head.

          head
          ↓
    old → A → B → C → D → 0
    

    2/ Adjusting the head.

              head
              ↓
    old → A → B → C → D → 0
    

    3/ Returning the old head (pointed at by old).

    If instead you’re talking about pushing something onto the stack, that’s an operation that involves:

    1/ Creating a new element.

        head
        ↓
    Z   A → B → C → D → 0
    

    2/ Pointing it towards the current head

        head
        ↓
    Z → A → B → C → D → 0
    

    3/ Adjusting the head to point to it.

    head
    ↓
    Z → A → B → C → D → 0
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm wanting to inherit from System.Web.Security.MembershipProvider - but I require more data than just
I was just wanting some explanation as to what is going on once you
I'm wanting to have a simple duck typing example in C# using dynamic objects.
I am performing a simple AJAX() request using Jquery (Google hosted 1.7.1 jquery.min.js code)
I'm wanting to integrate Twitter and Facebook into a game using Cocos2D. I just
I'm just wondering which method is the most effective if I'm literally just wanting
Just wondering if you could help wanting to produce an activity stream in Java,
Just a quick question regarding re-useable code. Ive lately been trying to modularise my
I have a simple function in my program, when I was wanting to mess
This is a very simple question. I often find myself wanting to create a

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.