Searching array by value

How can I find arrays index by value? for example:


1
2
int box = a,array[2]={b,a};


One way would be:
1
2
3
4
for(int i=0;i<2;i++){
 if ( box == array[i] )
  do stuff;


Is there some function or something that can do it?

Big, big thanks in advance.
Topic archived. No new replies allowed.