Explain searching elements in array using pointers.
Consider an array of five elements as shown below:
A[5]={ 10,20,30,40,50};
Search element(SE)=30
Pointer variable is declare as *ptr;
Before starting search process initialize pointer variable with the address of first element in an array.
ptr=&a[0];
Compare *ptr(value at address stored in ptr) with search element in every iteration. After each iteration ptr points to next location in an array.