Thread: Header file

  1. #1
    Registered User
    Join Date
    Aug 2009
    Posts
    192

    Header file

    Hi whats the header file for the function max(int, int) for C. I thought it was cmath.h or math.h but none of them are being shown in linux

  2. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,267
    The max function is defined in <algorithm> for C++, but I don't believe such a (portable) function exists for C. Of course you could always make your own:
    Code:
    int my_max(int a, int b)
    {
        return (a > b) ? a : b;
    }
    bit∙hub [bit-huhb] n. A source and destination for information.

  3. #3
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    You've got fmax and fmin, of course, in math.h. Granted those expect floating point.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need Help Fixing My C Program. Deals with File I/O
    By Matus in forum C Programming
    Replies: 7
    Last Post: 04-29-2008, 07:51 PM
  2. Replies: 30
    Last Post: 06-19-2006, 12:35 AM
  3. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  4. Making a LIB file from a DEF file for a DLL
    By JMPACS in forum C++ Programming
    Replies: 0
    Last Post: 08-02-2003, 08:19 PM