I am a new coder and new to C language. I want to know how to return the index position of a re-occurring number in an array. If the array was
values[10] = { 1 2 3 4 5 5 5 5 6 7} I would like the function to return the index position 4 as the re-occurrence of 5 begins from index position 4.
This is what I've managed to produce but don't know how to progress
int ReturningIndex(int values[], int numValues)
{
for(i=0;i<numValues;i++){
if(values[i + 1] == values[i] && values[i + 2] == values[i] && values[i + 3]
== values[i]){
//This is where I'm confused....
Aucun commentaire:
Enregistrer un commentaire