Check out example codes for "how to get the index of an item in a array in c++". It will help you in understanding the concepts better.

Code Example 1

#include <iostream>
using namespace std;

int main() {
  int array = {1, 2, 3, 4, 5};
  for (int i = 0; i < sizeof(array)/sizeof(array[0]); i++) {
	if (array[i] == 5) {
      cout << i;
    }
  }
  return 0;
}

Code Example 2

#include <iostream>
using namespace std;

int main() {
 	 
}

Learn ReactJs, React Native from akashmittal.com