Question: #include #include typedef struct node{ int key; struct node* next; } node_t; typedef node_t* node_ptr; void main() { node_ptr p = NULL; node_ptr listhead =

#include
#include
typedef struct node{
int key;
struct node* next;
} node_t;
typedef node_t* node_ptr;
void main()
{
node_ptr p = NULL;
node_ptr listhead = NULL;
/**
* FILL THE GAP:
* Create a listhead with key = 1,2,3,...,10
* Make sure next pointer is pointing to the
* next node
*/
/**
* FILL THE GAP:
* Delete node with key 5 6 and 7 in that order
*/
/**
* FILL THE GAP:
* Insert a new node with key 6
*/
/**
* Traverse the list and print the key
*/
p = listhead;
if(p==NULL)
{
printf("List empty ");
return;
}
/* traverse and print key */
while( p->next !=NULL)
{
printf("%d ", p->key);
p = p->next;
}
printf("%d ",p->key);
}
Your Code 1 #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
