Home > Back-end >  Who help me
Who help me

Time:04-26

Behind why to find the first no problem, can't normal to find ah

CodePudding user response:

Modified as follows, for your reference:
 # include 

Int pos_InArr (int arr [], int n, int nKey);

Int main ()
{
Int nKey, m;//n.
,13,14,15,16,17,18,19,11,20 int arr [10]={12};
Printf (" please input you want to query nKey: \ n ");
The scanf (" % d ", & amp; NKey);
M=pos_InArr (arr, 10, nKey);
If (m!=1)
The location of the printf (" % d to % d \ n ", nKey, m);
The else
Printf (" the value is not found! \n");

return 0;
}

Int pos_InArr (int arr [], int n, int nKey)
{
int i;
for(i=0; iIf (arr [I]==nKey)
return i;
//return - 1;
}
return -1;//return 0;
}
  • Related