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 |
What is a program?
i got 75% in all semester am i eligible for your company
What are pragmas and what are they good for?
What are the different data types in C?
what is a non volatile key word in c language?
write a c programming using command line argument,demonstrate set operation(eg;union,intersection,difference) example output is c:>setop 12 34 45 1 union 34 42 66 c:>setop 12 34 1 42 66 c:>setop 12 34 diff 12 56 67 78 setop 12 34
What is the use of sizeof () in c?
Distinguish between actual and formal arguments.
main() { int a; a=++100; printf("%d",a); getch(); }
Why we use break in c?
Explain data types & how many data types supported by c?
What is d'n in c?