ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
writw a program to insert an element in the begning of a 
doubly linked list
 Question Submitted By :: Guest
I also faced this Question!!     Rank Answer Posted By  
 
  Re: writw a program to insert an element in the begning of a doubly linked list
Answer
# 1
#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
Mani
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
write a c program to print a given number as odd or even without using loop statements,(no if ,while etc)  4
What will be the output of x++ + ++x? MBT13
Would you rather wait for the results of a quicksort, a linear search, or a bubble sort on a 200000 element array? 1) Quicksort 2) Linear Search 3) Bubble Sort  2
O,T,T,F,F,S,S,E,N,?,?,?,T,F,F,S,S,E,N ADP9
We can draw a box in cprogram by using only one printf();& without using graphic.h header file? NIIT3
main() { printf(5+"Vidyarthi Computers"); }  6
Give me basis knowledge of c , c++...  4
what are the interview question's in the language c Nipuna1
int zap(int n) { if(n<=1)then zap=1; else zap=zap(n-3)+zap(n-1); } then the call zap(6) gives the values of zap [a] 8 [b] 9 [c] 6 [d] 12 [e] 15 Wipro8
Write a program for the following series: 1*3*5-2*4*6+3*5*7-4*6*8+.................up to nterms Convex-Digital4
main() { char *p1="Name"; char *p2; p2=(char *)malloc(20); while(*p2++=*p1++); printf("%s\n",p2); } what is the output? Ramco4
find second largest element in array w/o using sorting techniques? use onle one for loop. Zycus-Infotech2
n=7623 { temp=n/10; result=temp*10+ result; n=n/10 } Wipro4
The C language terminator is a.semicolon b.colon c.period d.exclamation mark TCS3
How to reverse a string using a recursive function, with swapping?  4
pgm in c to reverse string by word using array(god is love becomes love is god) (no additional array can used,space is only delimiter between words ) Persistent1
What is difference between the following 2 lines…. int temp = (int)(0x00); int temp = (0x00int); Bosch3
C program code int zap(int n) { if(n<=1)then zap=1; else zap=zap(n-3)+zap(n-1); } then the call zap(6) gives the values of zap [a] 8 [b] 9 [c] 6 [d] 12 [e] 15 Wipro4
wap in c to accept a number display the total count of digit  4
how can we use static and extern?and where can we use this? Excel3
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com