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 |
Explain what does the format %10.2 mean when included in a printf statement?
Explain #pragma in C.
How the C program can be compiled?
please give code for this 1 2 4 7 11 16
how can write all 1to 100 prime numbers using for loop,if and break ?
Write a programme to find even numbers without using any conditional statement?
3 Answers ADD Software, Infosys,
I use turbo C which allocates 2 bytes for integers and 4 bytes for long. I tried to declare array of size 500000 of long type using the following code... long *arr; arr=(long *)(malloc)(500000 * sizeof(long)); It gives a warning that "Conversion may lose significant digits in function main"... And the resulting array size was very less around 8400 as compared to 500000. Any suggestions will be welcomed....
What is register variable in c language?
program to find out date after adding 31 days to a date in the month of febraury also consider the leap year
why to assign a pointer to null sometimes??how can a pointer we declare get assigned with a garbage value by default???
Write a c program to Find the name that you entered is male name or female name? Such as Sunjay is name of male and Payal is name of female
What is a union?