Teaching Rajasthan Basic Computer Instructor 2021 Mock Test Programming and Data Structure Linked List
How do you insert an element at the beginning of the list?
1
void insertatbegin (int item)
{
node *p;
p = (node *p) malloc (sizeof (node));
p → info = item;
if (start == null)
p → next = start;
else
p → next = null;
start = p;
}
2
void insertatbegin (int item)
{
node *p;
p = (node *p) malloc (sizeof (node));
p → info = item;
if (start == null)
p → next = null;
else
p → next = start;
start = p;
}
3
void insertatbegin (int item)
{
node *p;
p = (node *p) malloc (sizeof (node));
p → item = info;
if (start == null)
p → next = null;
else
p → next = null;
start = p;
}
4
void insertatbegin (int item)
{
node *p;
p → info = item;
if (start == null)
p → next = start;
else
p → next = start;
start = p;
}