What you are trying to do is not clear and understandable. Are you asking for returning the index of a given number of the array instead of the stored element within the array?
And.....
Please learn to use code tags, they make reading and commenting on source code MUCH easier.
#include <iostream>
int main()
{
// create an array
int arr[7] { 5, 15, 18, 3, 8, 19, 125 };
// what number do you want to find?
constint num_to_find { 8 };
// the found number index, -1 no match
int index { -1 };
for (int i { }; i < 7; ++i)
{
if (num_to_find == arr[i])
{
index = i;
break;
}
}
std::cout << num_to_find << " was found at array index: " << index << '\n';
}