This Function search an element from the list(if successful) otherwise not.
//Search Function void search() { int data,flag=0; printf("Enter data to be searched:"); scanf("%d",&data); fflush(stdin); Node *tptr=start; while(tptr) { if(tptr->info==data) { flag++; } tptr=tptr->Link; } if(flag!=0) { printf("%d found %d times\n",data,flag); } else { printf("%d not found\n",data); } }
Comments