Allocation of a new node


#1

How to allocate a new node?

   struct RandomListNode temp1 = RandomListNode(data) ;
    RandomListNode *temp = temp1 ;
    temp->label = data ;
    temp->next = Next ;
    temp->random = Random ;

Why does the above not work fine?


#2

To define temp1; use RandomListNode temp1=new RandomListNode(data);