# max **Description** : Compares two values, returning the greatest. **Example**: ```cpp int a = 7, b = 3; auto greatest = std::max(a, b); // prints 7 std::cout << greatest << " "; ``` **[See Sample code](../snippets/algorithm/max.cpp)** **[Run Code](https://rextester.com/RCHUQA23545)**