0
If you have a normal c array, int arr[2] or similar: int arr[2] = {3,1}; int elm=3; //What you need to find. int pos = std::distance(arr,std::find(arr,arr+2,elm)); if(pos<2) std::cout<<pos; else std::cout<<-1; You will need to include <iterator> for std::distance
24th Nov 2017, 7:20 AM
ProCpp