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

  • Home
  • SEARCH
  • 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

Ask A Question

Stats

  • Questions 315k
  • Answers 315k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer One easy trick that can help with most deadlocks is… May 13, 2026 at 11:10 pm
  • Editorial Team
    Editorial Team added an answer Use a BindingSource rather than directly relying upon the L2S… May 13, 2026 at 11:10 pm
  • Editorial Team
    Editorial Team added an answer I found solution! I had to delete all from cache… May 13, 2026 at 11:10 pm

Related Questions

I have a daemon that reads a configuration file in order to know where
I have a simple application using netbeans for developing and maven for building et
I am used to writing data manipulation logic in SQL and now that I
I've been tasked with automating the collection of some reports from our remote locations.
I am wanting to develop a staff directory application, listing all people in the

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.