Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Nov 2003 00:24:03 -0800
From:      Tim Kientzle <kientzle@acm.org>
To:        Jay Sern Liew <liew@jaysern.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: integer and long max/min values
Message-ID:  <3FBDCBA3.3080100@acm.org>
In-Reply-To: <20031120223816.G61303@pinnacle.schulte.org>
References:  <20031120223816.G61303@pinnacle.schulte.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3FBDCBA3.3080100>