编辑代码

#include <iostream>
using namespace std;
int searchArray(int searchKey,int array[],int arrLen){
    int keyPos=-1;
    for(size_t i=0;i<arrLen;i++)
    {
        if(array[i]==searchKey){
            keyPos=i;
            break;
        }
    }
    return keyPos;
}