Preview:
#include<iostream>
using namespace std;
void getMinMax(int arr[], int arrSize, int *minVal, int *maxVal)
{
  for (int i = 1; i < arrSize; i++)
  {
    if (arr[i] > *maxVal)
    {
      *maxVal = arr[i];
    }
    if (arr[i] < *minVal)
    {
      *minVal = arr[i];
    }

  }
}
int main()
{
  int arr[5] = { 1, 2, -9, 45, 0};
  int max = arr[0];
  int min = arr[0];
  getMinMax(arr, 5, &min, &max);
  cout << min << " " << max << endl;
  return 0;
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter