A Program to
search the given element
in entered array
using pointer.
Program:
#include<iostream>
using namespace std;
int main()
{
int
a[5],search,i,*b;
cout<<"\n\n Enter 5 elements of the array: ";
for(i=0;i<5;i++)
cin>>a[i];
cout<<"\n\n Enter Search value: ";
cin>>search;
b=a;
for(i=0;i<5;i++)
{
if(*b==search)
{
cout<<"\n\n Element found at "<<i+1;
break;
}
b++;
}
if(i==5)
cout<<"\n\n Element not found. ";
return 0;
}
Output: