M.K.Dan
0
Q:

c++ max of array

cout << " max element is: " << *max_element(array , array + n) << endl;
3
*max_element (first_index, last_index);
ex:- for an array arr of size n
*max_element(arr, arr + n);
3
// C++ program to demonstrate the use of std::max 
// C++ program to demonstrate the use of std::max 
#include<iostream> 
#include<algorithm> 
using namespace std; 
int main() 
{ 
    // Comparing ASCII values of a and b 
    cout << std::max('a','b') << "\n"; 
  
    // Returns the first one if both the numbers 
    // are same 
    cout << std::max(7,7); 
  
return 0; 
}  
3

New to Communities?

Join the community