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...

Product Design
Product DesignThere are three Main Point to Be Consider To Start Product Design: Functionality Mechanism Assembly These point is important role in any prodct design start .like :- mechanical parts, plastics parts, Sheetmetal Part.
A

Acad Design Solutation

0 0
0

Role of numerical methods in Electronics & Communication and Electrical Branches and how to deal with it.
1) Role of Numericals: These problems are based on realizing circuits, being a R&D engineer, I would like to suggest all students to lay emphasis on Numerical Problems as they are very important both...

What is buttress dam?
Buttress Dam consists of a watertight upstream side, usually reinforced concrete, supported by triangular-shaped walls, called buttresses on the downstream side. This kind of dam uses less concrete compared...

7 -WAYS THAT CAN IMPROVE THE LIFE OF A STUDENT
1. Classroom attentionSometimes #students loose their concentration in to the #classroom and not grasp the topic properly and hence loose their interest in to subject (s). As a result bad score bad performance....
D

Dr

1 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