I understand the concept of the linked list but do not actually understand how it works. For instance, I get how each node points to the one after it. However, I am not sure why it doesn't create a node with the same name every time. An explanation would be greatly appreciated. Thanx.

P.S. If I am totally wrong with the concept of it, explain it to me please.

2. > However, I am not sure why it doesn't create a node with the
> same name every time. An explanation would be greatly
> appreciated

Same 'name'? Not sure the question:

node *n;

n = new( node );
n->next = new( node );
n->next->next = new( node );

All we're doing is allocating a block of memory the size of a 'node' and pointing at it. It has no name. It's "name" is the name of whatever variable you use to point at that block:

node *someName;

someName = n->next->next;

someName now points to a block of memory we allocated, which happens to be the third item in our list now.

Quzah.

3. o, so the second and third and fourth node do not actually have a name such a the head node with a title. for instance:

--> means that it points too

head node -->second node (next node)--> third node (next next node from first node)

basically, the third node will not a unique name like third and only the head node will have a unique name like first or whatever??

4. Unique name? I guess, you mean a name for each node? The linked list is treated as a datastructure on it self. Though you could put an identifier in the node-structure which identifies the node:

typedef struct node *pnode;
struct node
{
int id;
pnode next;
}

The list could be defined as:

pnode list;

That pointer points to the start of the list and shouldn't be changed. Since then you lose information. If you do:

list = list->next;

Then you can never go to the start of the list. In order to walk through the list you should define another pointer which points to an element of the list.

pnode list_ptr;

Let this pointer point to the start of the list:

list_ptr = list;

And walk through the list by:

while (list_ptr != NULL)
{
list_ptr = list_ptr->next;
}

5. ## Thanx

Thanx everyone, I got it now.