Looking for a macro that takes four arguments and returns the largest value?

This is a discussion on Looking for a macro that takes four arguments and returns the largest value? within the C Programming forums, part of the General Programming Boards category; Looking for a macro that takes four arguments and returns the largest value? #define MAX4 (A, B, C, D)...

  1. #1
    Unregistered
    Guest

    Question Looking for a macro that takes four arguments and returns the largest value?

    Looking for a macro that takes four arguments and returns the largest value?

    #define MAX4 (A, B, C, D)

  2. #2
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,386
    >Looking for a macro that takes four arguments and returns the
    >largest value?

    No, I'm not looking for such, but I guess you are.

    Code:
    #define MAX4(a,b,c,d) ((((a > b) ? a : b) > c) ? ((a > b) ? a : b) : c) > d ? \
                          ((((a > b) ? a : b) > c) ? ((a > b) ? a : b) : c) : d
    Last edited by Shiro; 05-05-2002 at 10:26 AM.

  3. #3
    Unregistered
    Guest

    Cool thnx :)

    thnx

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. NULL arguments in a shell program
    By gregulator in forum C Programming
    Replies: 4
    Last Post: 04-15-2004, 11:48 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21