writw a program to insert an element in the begning of a
doubly linked list
Answer / mani
#include<stdio.h>
typedef struct node {
int data;
struct node *leftlink;
struct node *rightlink;
}node;
node *start=NULL;
node *tail=NULL;
void add_begin(node *);
main()
{
.......
.......
add_begin(start);
.......
.......
}
void add_begin(node *temp)
{
node *new_node=NULL;
int idata;
printf("enter the data part value: ");
scanf("%d",&idata);
if(start==NULL && tail==NULL )
{
new_node=(node *)malloc(sizeof(node));
new_node->data=idata;
new_node->leftlink=NULL;
new_node->rightlink=NULL;
start=new_node;
tail=new_node;
}
else
{
new_node=(node *)malloc(sizeof(node));
new_node->data=idata;
temp->leftlink=new_node;
new_node->rightlink=temp;
new_node->leftlink=NULL;
start=newnode;
}
}
| Is This Answer Correct ? | 3 Yes | 0 No |
int main() { int x = (2,3,4); int y = 9,10,11; printf("%d %d",x,y); } what would be the output?
What is an lvalue in c?
wat is the output #define VOLEDEMORT _who_must_not_be_named int main() { printf("VOLEDEMORT"); }
Explain how can you check to see whether a symbol is defined?
Which one to choose from 'initialization lists' or 'assignment', for the use in the constructor?
what is pointer ? what is the use of pointer?
main() { int *ptr=(int*)malloc(sizeof(int)); *ptr=4; printf("%d",(*ptr)+++*ptr++); }
5 Answers Vector, Vector Solutions,
write a program to find out prime number using sieve case?
what is the most appropriate way to write a multi-statement macro?
What is maximum size of array in c?
What is the difference between test design and test case design?
What are shell structures used for?