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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:50:07+00:00 2026-06-10T10:50:07+00:00

So we have been learning about linked lists in my CS class and I

  • 0

So we have been learning about linked lists in my CS class and I understand the concept just fine. However, when looking at an example program my professor assign the code he provided was different than what we were shown in class.

Here’s the code from the example:

        struct itemType
        {
            string store_name, item_name;
            int item_number, quantity; 
            float price;
        } ;

        struct node
        {
             itemType item;
             node *next;    //  
             **node (itemType it, node* n=NULL)
             {
                 item=it;
                 next=n;
             }**
         };

I don’t understand why he called node within the node struct and have it take two parameters (the part in the code contained within the ‘**’). It looks like a constructor or something. Every example on linked lists I’ve googled or read about does not have that little bit of code there!

But any help you guys can give me would be greatly appreciated!

  • 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-10T10:50:09+00:00Added an answer on June 10, 2026 at 10:50 am

    That example is C++ code. A class in C++ is an extension of the struct concept, in fact about the only difference between a class and a struct is that in a struct all members are public by default whereas in a class they are private by default. This is due to the historical beginnings of C++ as “C With Classes” – just replace struct with class, add “public:” and it will look less foreign:

        struct itemType
        {
            string store_name, item_name;
            int item_number, quantity; 
            float price;
        } ;
    
        class node
        {
        public:
             itemType item;
             node *next; 
             node (itemType it, node* n=NULL) // Constructor
             {
                 item=it;
                 next=n;
             }
         };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have recently been learning about vertex coloring . The program worked fine when
I'm learning Python and have been trying to understand more about the details of
I have been learning about IE's rather ridiculous-looking requirements for shadows, gradients, etc., and
In my class we have been learning about different designs such as MVC and
I have just been learning about operator overloading and I wanted to try to
I have just been learning about how styles and control templates in WPF can
I have been learning about Delegation and Data Sources for iOS programming and need
Recently I have been learning about WMI and WQL. I found out the list
I have been learning the Definitive Guide of JavaScript.i got a question about the
I am currently learning about basic networking in java. I have been playing around

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.