Why it returns max anyway?

49 Views Asked by At

A minute ago, I wrote a function without return of finding max value in C++,

#include <iostream>
#include <algorithm>
using namespace std;

int myItem(int x, int y, int z)
{
    int a = std::max(x, y);
    int b = std::max(a, z);
    // return b;
}

int main()
{
    cout << myItem(2, 5, 16);
}

But, why it returns max value without return?

On the Windows, g++ (MinGW.org GCC-6.3.0-1) 6.3.0.

0

There are 0 best solutions below