Quick question - maximum value

Sorting not necessary if we just want the maximum. Assuming the numbers are in an array, something like this should work (compiles, but I didn't test it):

    int myNumbers[100], maxValue;
    //assign values to myNumbers somehow
    maxValue = myNumbers[0];
    for (int n=1; n<100; n++) {
        if (myNumbers[n] > maxValue) maxValue = myNumbers[n];
        //or, instead of the if statement above:
        //maxValue = max(maxValue, myNumbers[n]);
    }