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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:36:48+00:00 2026-06-04T21:36:48+00:00

I am working on homework and wanted to know what this is actually defined

  • 0

I am working on homework and wanted to know what this is actually defined as:

list < NAME > * m_ofList

Where name comes from a struct like so:

typedef struct name
{
    int age;
    int height;
} NAME;

I want to know what it is so I know how to insert to it or access it: push_back, insert, etc.

So I understand this now, but I am stuck because of some type of memory access: it produces a segmentation fault and I have been unable to figure this out.
Where do I need to initialize my new list? it doesn’t work in constructor or in the functions. Just FYI, it is a private list so it can only be used for member functions (i.e. m_ofList). I can produce code if anyone would like to help…

  • 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-04T21:36:50+00:00Added an answer on June 4, 2026 at 9:36 pm

    Assuming using namespace std or using std::list, that’s a pointer to a list of objects of the class/struct NAME. To put objects in it, first you need to initialize it:

    m_ofList = new list<NAME>;
    

    or:

    m_ofList = &(some already initialized list of NAME objects);
    

    Then you can put items in it:

    NAME x;
    x.age = 15;
    x.height = 150;
    m_ofList->push_back(x);
    m_ofList->insert(m_ofList->begin(), x);
    

    If you went with dynamically allocating the list with new, it needs to be properly disposed of when you are done with it:

    delete m_ofList;
    

    My question for you is, why is it a pointer in the first place? You could just declare it (as you should) like this:

    list<Name> m_ofList;
    

    Then you wouldn’t have to worry about disposing of it. It would be taken care of by scoping rules.

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

Sidebar

Related Questions

I am working on some homework and wanted to know if there is such
I'm working on this homework that's kind of confusing me... I am provided with
I'm working on a homework project that requires me to create an object from
I am working on this homework assignment and I am stuck on what I
I am working on my last homework assignment for COBOL this semester and I
I've been working on this for about 5 hours for homework and I was
I am working on a single linked-list calculator in C (yes, it's homework). I
Working on a homework assignment and am stuck with this task: Create a loop
I am working on a homework assignment, beginning C#. Have to accept input from
I'm working on homework and I'm close but I am having an issue. I

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.