max element in an array C++ stl vector code example Example: max element in vector c++ auto max = *max_element(vector.begin(), vector.end());