Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ max(3C) — DG/UX 4.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought



                                                                  max(3C)



        _________________________________________________________________
        max                                             $builtin function
        Return the maximum value of two integers.
        _________________________________________________________________


        Calling Sequence

        int a, b, c, max();
        a = max(b, c);

        (or)

        $builtin int max();
        int a, b, c;
        a = max(b, c);


        Description

        Return the integer maximum of two numbers with the max function.
        The first version noted above uses a function call.  The second
        might generate smaller or faster code.  The include file math.h
        defines this entry and uses the $builtin version.


        Returns

        The max function returns the maximum of the two integers you pass
        to it.


        Related Functions

        See also the fmax and min functions.


        Example

        /* Program test for the max() function */

        #include <math.h>

        int   i = 1, a, b, c, max();

        main(argc, argv)
        int     argc;
        char    *argv[];
        {
            while (i+1 < argc) {
                a = atoi(argv[i]);



        DG/UX 4.00                                                 Page 1
               Licensed material--property of copyright holder(s)





                                                                  max(3C)



                b = atoi(argv[i+1]);
                printf("Maximum of %d and %d is %d.\n",
                a, b, c = max(a, b));
                i++;
            }
        }

        A call to the program test with the numbers 64, 16, 32, and 8
        generates the output

        Maximum of 64 and 16 is 64.
        Maximum of 16 and 32 is 32.
        Maximum of 32 and 8 is 32.









































        DG/UX 4.00                                                 Page 2
               Licensed material--property of copyright holder(s)



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026