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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:33:10+00:00 2026-06-01T20:33:10+00:00

Say I have a linked list node class class node { private: node *next_node;

  • 0

Say I have a linked list node class

class node {
    private: 
        node *next_node;
    public:
        node *next() const;
};

node *node::next() const {
    return next_node;
}

Does next() return a node **next_node or node *next_node. Also what is the significance of either in implementing the list class functions (ie. insert, remove, find)?

The reason I would think it returns a **next_node is because next_node is already a pointer and returning it in a function as a pointer would make it a pointer to a pointer. I read in other questions such as: Linked list head double pointer passing that double pointers also work in list operations so I was a bit confused.

  • 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-06-01T20:33:13+00:00Added an answer on June 1, 2026 at 8:33 pm

    The node::next() function as implemented is returning a copy of the next_node member variable. Both next_node and this copy point to the same node instance but they are otherwise independent of each other.

    Here is some rather bad ASCII art that tries to demonstrate their relationship

    next_node ----> [node instance]
                    ^
    the copy ------/
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say you have 2 classes: - Node - Doubly linked list (DLL) Your
Say you have a linked list structure in Java. It's made up of Nodes:
Lets say have this immutable record type: public class Record { public Record(int x,
Say I have a class named Frog, it looks like: public class Frog {
My problem is deleting a node from linked list. I have two structs :
I have an assignment that requires us to implement a doubly linked list class.
Ok so let's say we have a linked list of characters with a head
I have implemented a simple linked list class and I would now like to
I have created two classes, class A that uses a Linked List and class
Let's say I have a class like this: class LinkedList { struct Node {

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.