binary_search with Pointers
<p>i want to  implement binary_search with  pointers</p>

<pre><code>#include &lt;cstdlib&gt;
#include &lt;iostream&gt;
using namespace std;

int binary_p(int x[],int size,int target){
    int *p=&amp;x[0];
    int *q=&amp;x[size];

    while(p&lt;q){
               int mid=(p+q)&gt;&gt;2;
               if (target==x[*mid]) return 1;
               else if(target&lt;x[*mid])  q=mid-1;
               else p=mid+1;





               }   
    return -1;


}
int main(int argc, char *argv[])
{
    int x[]={2,4,6,7,9,10,12};
    int size=sizeof(x)/sizeof(int);
    int target=9;
    cout&lt;&lt;binary_p(x,size,target)&lt;&lt;endl;
    system("PAUSE");
    return EXIT_SUCCESS;
}
</code></pre>

<p>but here is error list</p>

<pre><code>  prog.cpp: In function ‘int binary_p(int*, int, int)’:
prog.cpp:10: error: invalid operands of types ‘int*’ and ‘int*’ to binary ‘operator+’
prog.cpp:11: error: invalid type argument of ‘unary *’
prog.cpp:12: error: invalid operands of types ‘int*’ and ‘int’ to binary ‘operator*’
prog.cpp:12: error: invalid conversion from ‘int’ to ‘int*’
prog.cpp:13: error: invalid conversion from ‘int’ to ‘int*’
prog.cpp: In function ‘int main(int, char**)’:
prog.cpp:30: warning: ignoring return value of ‘int system(const char*)’, declared with attribute warn_unused_result
</code></pre>

<p>please could anybody  give me advise</p>
