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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:20:26+00:00 2026-06-10T05:20:26+00:00

I have a structure as struct Employee { char uName [255]; struct Employee *

  • 0

I have a structure as

struct Employee 
{ 
 char   uName  [255]; 
 struct   Employee *  next; 
 struct   Employee *  prev; 
};

All i want to allocate memory of 100 stucture objects at a time and then use them one by one i making a linked list.If the memory is consumed fully then again i want to allocate 100 object memory

I am doing the allocation as

struct Employee * chunk=new struct Employee[100];

Now when i want to add a new node to a linked list i want to take objects from this already allocated memory.Can somebody tell how to achieve this

Employee * pEmployeeData=NULL;
for(long int i=1;i<=100;i++)
{
        pEmployeeData=EmployeePool+i;
        pEmployeeData->next=NULL;
        pEmployeeData->prev=NULL;
        InsertAtEnd(pEmployeeData);
}

where InsertAtEnd inserts the node at the end of the linked list.Please tell how to achieve 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-06-10T05:20:28+00:00Added an answer on June 10, 2026 at 5:20 am

    I would strongly suggest that you don’t try to reinvent the wheel by writing your own linked list, instead have a look at the C++ standard library which contains ready-made container types available for you to use. (for example std::vector and std::list).

    Container types exist in the C++ standard library, and are used for storing collections of data/objects. for example, you could do something along the lines of

    #include <iostream>
    #include <vector>
    #include <string>
    
    struct Employee
    {
        std::string name;
        int id;
    };
    
    int main()
    {
        std::vector<Employee> my_employees;
    
        Employee fred = { "Fred", 1 };
        Employee bob = { "Bob", 2 };
    
        my_employees.push_back( fred );
        my_employees.push_back( bob );
    
    
        std::cout << my_employees[0].id << " " << my_employees[0].name << "\n"
                  << my_employees[1].id << " " << my_employees[1].name << std::endl;
    }
    

    The standard containers are easy to use and to learn (You’ll find plenty of internet resources which describe how to use them – and your book should also tell you!); If you’re new to C++, then it’s highly advisable to start out by figuring out how to use these before attempting to create your own.

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

Sidebar

Related Questions

I have a structure of type: struct hashnode_s { struct hashnode_s *next; char *key;
I have a structure: typedef struct stock { const char* key1p2; // stock code
I have a structure typedef struct store { char name[11]; int age; } store;
I have some problems with Eclipse, I have structure struct Account{ const char* strLastName;
we have a data structure struct MyData { int length ; char package[MAX_SIZE]; };
I have structure like this below. Now, I want swap 2 structures. public struct
Let's say you have this structure: struct MMFS_IDENTIFICATION { char *szVendor; char *szControllerModel; char
i have written this structure: struct bmpheader { unsigned char magic[2]; unsigned int fsize;
I have the following structure: struct hashItem { char userid[8]; char name[30]; struct hashItem
I have a structure like struct board{ char name; int values[37]; }board Imagine a

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.