Check out example codes for "c++ function to find minimum element in array". It will help you in understanding the concepts better.

Code Example 1

for maximum element

int maximum = *max_element(A,A+n);

int minimum = *min_element(A,A+n);

Learn ReactJs, React Native from akashmittal.com