answersLogoWhite

0

A pointer is a memory reference to a data structure. So when you allocate memory for your list elements, they will be stored at some address X in your system memory. A pointer is simply a variable that contains that address X. You can access the memory that a pointer points to by dereferrencing it with the * operator.

Ex:


int main()
{
LinkedList *x; /* Declare a pointer to a linked list (a type which you would have to define using "struct" or "class") */


x = new LinkedList(); /* Here we create (aka "instantiate") a LinkedList object and allocate memory for it, x now contains (points to) the memory address of our LinkedList object */


// You can now access any LinkedList members through x, for example x->next might point you to the next element of your LinkedList

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

How the pointer used in the linked list?

The pointer in linked list is used for traversing through the elements of the linked list. In a singly linked list, only a next pointer exits. So this pointer can be used for traversing only in one direction in the list. In case of a doubly linked list, a next and previous pointer exits. These pointers are used for traversing in both direction in the list.


How do you check whether a linked list is circular?

A linked list is circular if the tail of the list points to the head. The easiest way to check this is to check whether the pointer of the tail is a null pointer. If it is, then the list is not circular.


What pointer type will you use to implement a heterogeneous linked list in c?

void pointer


32 can you create a linked list with out structure pointer?

Not in C, no.


What is difference between linked list and singly linked list?

Answersingly linked list has the node inserted only at one end. and the pointer corresponds to the next pointer.but in a doubly linked list, the node pointer points to the both previous and the next node.singly linked list has two nodesdoubly linked list has three nodesA doubly linked list makes sense when you need to traverse the list in both directions. You aren't able to do that with a singly linked list.


How can a binary tree be converted into a doubly linked list?

To convert a binary tree into a doubly linked list, perform an in-order traversal of the tree and adjust the pointers to create the doubly linked list. This involves setting the left child pointer to the previous node and the right child pointer to the next node in the list.


What is linked list in C langauage?

A linked list is a collection of items, often nodes, that are sequentially linked by some kind of index or pointer contained within each item.


Write the concepts of linked list?

A simple linked list is built out of nodes. Each node consists of two sections, data and a pointer. The data contains whatever information that this node of your list needs to contain, and the pointer contains the memory address of the next node in your list.


What are the linked list utility in memory management?

A simple linked-list is an approach is to store the freelist of memory blocks, where each node of the linked list contains a pointer to a single free block in the memory pool.


Need for header node in linked list?

The utility of a header node in a linked list is to simplify the functions of adding and deleting elements in the list. If you have a pointer in memory that points to the first element, then you need to pass the address of that pointer, rather than the value of that pointer, to the routines for list manipulation, because that pointer would need to change if an element were added or deleted at the head of the list. If that pointer, however, points to a special element in the list which is actually the pointer to the head of the list, then you do not need to pass the address of the pointer - you can pass its value, and it will never change. This technique "wastes" the data portion of that first element.


How do you point to the first node in a linked list?

The list itself should maintain a pointer to the first node in the list. If it is NULL, the list is empty.


What is the pointer to the next node on a linked list called?

It is usually just called the link.