#include <algorithm> std::array<int, 3> arr = {1,2,3} // your array here if (std::find(std::begin(arr), std::end(arr), 3) != std::end(arr)) { // code here }