I have the following struct:
struct Node{
int *VC;
Node *Next;
};
My goal is to create a linked list of pointers pointing to an int
My question is how can i allocate memory for Node.
ie
int* ptr = (int *) malloc(sizeof(int)*10);
//code to allocate memory for a new Node n
n->VC = ptr;
n->Next = null;
then later i may do:
int *_ptr= (int *) malloc(sizeof(int)*10);
//code to allocate memory for a new Node c
c->VC= _ptr;
c->Next = null;
n->Next = c;
1 Answer