how to find the index of array in c++ code example
Example: how to get the index of an item in a array in c++
#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;
}