Linked List Linked List

Hi!!!

I hope you can help me with a problem, i have a linked list and i need to insert a list of values inside every node of it, and i don't know how to do it,
Then make the list nodes hold another list or a different container.
What's the problem?
 
list< list<int> > mylistofalist;
Ok ... Thanks, but to do what you say Disch, it generates a huge mistake ... What happens is that the type of data (instead of int) is a structure to another class ... In fact, the program acts as a directory manager who in turn manage files, each file has the name and size as variables ...
A slightly modified version of Disch's approach:

list< list<my_struct> > my_list_of_lists_of_my_struct;

More info on std::list -> http://cplusplus.com/reference/stl/list/
Last edited on
My previous post was more of an abstract concept (and, well, a bit of sarcastic elitism).

I'm glad m4ster r0shi elaborated. Now I feel like less of a jerk.
Hahaha ... Do not worry ... I understand ... Really, I had not previously made errors of this type ... Thanks for the support ... I'll read the other comments and material on the subject ...
Hi,
I am giving you a source code in C how to insert node in a linked list

Step1. Create a Linked List.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
 # include <stdio.h>
      # include <conio.h>
      # include <alloc.h>
      
      struct node
        {
         int data;
         struct node *next;
         } * start;
      void create()
         {
         start=(struct node *) malloc (sizeof(structnode));
         printf(" enter the data you want to insert:")
         scanf("%d",&start->data);
         start->next=NULL;
         return;
         }


this is how you have to create a linked list.
Step 2. After creating linked list youn insert the data at
(a) Beginning
(b) End
(c) Middle.


enhance your c , c++ knowledge by reading some introduction to c++ books.
http://www.wiziq.com/tutorial/762-C-Basic-Introduction

Regards
Kolla Sanjeeva Rao
Topic archived. No new replies allowed.