Re: integer and long max/min values

From: Tim Kientzle (kientzle_at_acm.org)
Date: 11/21/03

  • Next message: Peter Pentchev: "Re: interrupt statistics"
    Date: Fri, 21 Nov 2003 00:24:03 -0800
    To: Jay Sern Liew <liew@jaysern.org>
    
    

    Jay Sern Liew wrote:
    > how do I find out the maximum (and minimum) value a long and int will hold
    > in C? (before it overflows or underflows)

    #include <limits.h>

    INT_MAX and INT_MIN are the max/min values for an int
    LONG_MAX and LONG_MIN are the max/min values for long.

    Also, see stdint.h, which is defined in C99.

    Also, buy a good C reference book. ;-)

    Tim Kientzle

    _______________________________________________
    freebsd-hackers@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
    To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"


  • Next message: Peter Pentchev: "Re: interrupt statistics"

    Relevant Pages

    • RE: integer and long max/min values
      ... Write a simple C program to ++ an int or long variable and see when it overflows. ... > Tim Kientzle ... > To: Jay Sern Liew ... To unsubscribe, ...
      (freebsd-hackers)
    • Re: integer and long max/min values
      ... >how do I find out the maximum value a long and int will hold ... (before it overflows or underflows) ... >if it's compiler-dependent, then does anyone know where I can find the GCC ...
      (freebsd-hackers)
    • integer and long max/min values
      ... how do I find out the maximum value a long and int will hold ... (before it overflows or underflows) ... if it's compiler-dependent, then does anyone know where I can find the GCC ...
      (freebsd-hackers)
    • Re: rand() / (RAND_MAX / N + 1)
      ... George Huber wrote: ... so the way I understand the problem is that (6 * rand()) is ... greater then an int therefore it overflows. ...
      (alt.comp.lang.learn.c-cpp)
    • Re: rand() / (RAND_MAX / N + 1)
      ... George Huber wrote: ... so the way I understand the problem is that (6 * rand()) is ... greater then an int therefore it overflows. ...
      (alt.comp.lang.learn.c-cpp)