Here is my data structure
struct Node{
int x;
Node *next;
Node *prev;
}
If I allocate memory
Node *A = malloc (sizeof (Node) * 10);
How can I access each box in the array using array index in this case? or it’s not possible?
My goal just want to make a linked list in this chunk of memory.
basically i want to assign a block of memory and then assign their prev and next….
maybe it’s confusing , sorry about my wording..
This gives you an array of 10
Nodes, accessible throughA. Now, all you have to do is e.g.to set the
nextvalue of the first node.