Write a program to search an element from a link list.

//search an element

// use tubo c++ to run this program
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
struct node
{
int info;
struct node *link;
};
struct node *n,*first,*this1;
int main()
{
char ch;
int item;
clrscr();
first=NULL;
printf(“Enter q to quite: “);
while((ch=getche())!=’q’)
{
n=(struct node*)malloc(sizeof(struct node));
printf(“\nEnter info= “);
scanf(“%d”,&n->info);
n->link=NULL;
if(first==NULL)
first=n;
else
{
this1=first;
while(this1->link!=NULL)
this1=this1->link;
this1->link=n;
}
printf(“Enter q to quite: “);
}
this1=first;
while(this1!=NULL)
{
printf(“\n%d”,this1->info);
this1=this1->link;
}
printf(“\nEnter item to search: “);
scanf(“%d”,&item);
this1=first;
while(this1->info!=item&&this1!=NULL)
this1=this1->link;
if(this1->info==item)
printf(“%d”,this1->link);
else
printf(“Item not found: “);
getch();
return 0;
}