integer and long max/min values

Tim Kientzle kientzle at
Fri Nov 21 00:24:06 PST 2003

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

More information about the freebsd-hackers mailing list