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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:42:33+00:00 2026-05-27T08:42:33+00:00

class Nodetype { int info; Nodetype next; Nodetype(int i) { info=i; next=null; } }

  • 0
class Nodetype
{
  int info;
  Nodetype next;

  Nodetype(int i)
  {
     info=i;
     next=null;
  }
}

My textbook has this code to create Linked List dynamically.
The question is, when the programs is executed line-by line, it defines variable ‘info’ as type ‘int’ & then variable ‘next’ as Nodetype.

What is actually happening here?

does it mean that variable ‘next’ will contain –

  1. Constructor ‘Nodetype’
  2. int info
  3. Nodetype “next” where “next” will again have all 1,2,3 & then 3 will again have 1,2,3…and so on….till infinity?

I’m really irritated because I’m unable to understand how it works, can someone easily explain this?

  • 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-27T08:42:33+00:00Added an answer on May 27, 2026 at 8:42 am

    At first variable next doesn’t point to any object(it points to null). At some time you will make it point to another node with next = new NodeType(number). The idea is that you use composition – you have one instance of class which has a reference to another instance. It is like nodeA points to nodeB, nodeB points to nodeC. Here you have three instances and the first instance has a reference to the second instance and the second instance has a reference to the third instance. The third instance is the last one and its next instance points to null.

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

Sidebar

Related Questions

I have a simple container : template <class nodeType> list { public: struct node
class A: pass def b(self): print('b') A.b = b a = A() At this
class X { int i; public: X() { i = 0; } void set(int
class A{ virtual int foo1(int a){ return foo1_1(a,filler(a)); } template<typename FunctionPtr_filler> int foo1_1(int a,
class a{ public void foo(int a){ System.out.println(super); } } class b extends a{ public
I got this scenario: while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element && reader.Name ==
I'm using this for my code, it outputs to the xml file perfectly, but
I have a class like this : class User { String name; String password;
I am trying to format a linked list so that it prints 5 nodes
I know this is probably a first year question, but I'm having some problems

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.