UrbanPro
true

Take BTech Tuition from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

Data Structure with C

S
Sudipta Saha
19/11/2016 0 0

#include

#include

#include

#include

struct node

{

int data;

struct node *next;

}*start=NULL;

void create();

void display();

void search();

void main()

{

int ch;

clrscr();

while(1)

{

printf("choose... 1. create node \n 2.display \n 3. search \n 4. exit\n");

      scanf("%d",&ch);

switch(ch)

{

case 1:

create();

break;

case 2:

display();

break;

case 3:

search();

break;

case 4:

exit(0);

break;

default:

printf("invalid choice \n");

}

}

}

void create()

{

 

  struct node *p,*q;

p=(struct node *)malloc(sizeof(struct node));

 int  a;

 printf("press -1 to exit \n");

 scanf("%d",&a);

 while (a!=-1)

 {

  printf("\n Enter the data : ");

  scanf("%d",&p->data);

  p->next=NULL;

if(start==NULL)

  {

  start=p;

  return;

  }

    q=start;

    while(q->next!=NULL)

q=q->next;

 q->next=p;

}

  }

void display()

{

struct node *q;

 printf("The Linked List : n");

 q=start;

 while(q!=NULL)

   {

   printf("%d--->",q->data);

   q=q->next;

   }

}

 

 void search()

 {

   int item=0,f=0;

 struct node *q;

  printf (" enter the data to searche \n");

  scanf("%d",&item);

  q=start;

  while(q!=NULL)

  {

      if(q->data==item)

     {

      f=1;

      break;

      }

  q=q->next;

   }

   if (f==1)

       printf(" search successful \n");

       else

       printf(" searching not sucessful \n");

  }

0 Dislike
Follow 0

Please Enter a comment

Submit

Other Lessons for You

N-Type Silicon
• Pentavalent impurities such as phosphorus, arsenic, antimony, and bismuth have 5 valence electrons. • When phosphorus impurity is added to Si, every phosphorus atom’s four valence electrons...

Starting Career in Android Development
Starting career in Android has become trouble free now. There is a lot of content available online to start learning Android. Just type “Android development” in Google and you will be flooded...

Introduction To Electric Drives
Drives are employed for systems that require motion control e.g. transportationsystem, fans, robots, pumps, machine tools, etc. Prime movers are required in drive systems toprovide the sources: diesel...

Review of Thermo
Which of the following process can be made reversible with the help of a regenerator? (A) Constant pressure process (B) Constant volume process (C) Constant pvn process (D) All of these Correct...

Failing in relatively easy subjects - remedies
Often most parents complains that their ward cleared many hard subjects but could not cleared the easy subject. The students perception about the subject makes it easier or harder not the course content....
B

Babu T

0 0
0
X

Looking for BTech Tuition Classes?

The best tutors for BTech Tuition Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Take BTech Tuition with the Best Tutors

The best Tutors for BTech Tuition Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more