Date: Fri, 21 Nov 2003 20:31:54 +0200 From: Peter Pentchev <roam@ringlet.net> To: Vijay.Singh@nokia.com Cc: kientzle@acm.org Subject: Re: integer and long max/min values Message-ID: <20031121183154.GC74629@straylight.m.ringlet.net> In-Reply-To: <4D7B558499107545BB45044C63822DDE02C094C1@mvebe001.americas.nokia.com> References: <4D7B558499107545BB45044C63822DDE02C094C1@mvebe001.americas.nokia.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--ZwgA9U+XZDXt4+m+ Content-Type: text/plain; charset=windows-1251 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Nov 21, 2003 at 09:53:50AM -0800, Vijay.Singh@nokia.com wrote: [format recovered; Tim Kientzle wrote:] > > Jay Sern Liew wrote: > > > how do I find out the maximum (and minimum) value a long=20 > > and int will hold > > > in C? (before it overflows or underflows) > >=20 > > #include <limits.h> > >=20 > > 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. > >=20 > > Also, see stdint.h, which is defined in C99. > >=20 > > Also, buy a good C reference book. ;-) > >=20 > > Tim Kientzle [..and Vijay Singh wrote:] >=20 > Write a simple C program to ++ an int or long variable and see when it > overflows. Why, after Tim actually quoted the exact header file to include and the exact constants to use? G'luck, Peter --=20 Peter Pentchev roam@ringlet.net roam@sbnd.net roam@FreeBSD.org PGP key: http://people.FreeBSD.org/~roam/roam.key.asc Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553 You have, of course, just begun reading the sentence that you have just fin= ished reading. --ZwgA9U+XZDXt4+m+ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (FreeBSD) iD8DBQE/vloa7Ri2jRYZRVMRAl72AKDGCKzTnSF6z12N6N+zBzd+BuzfwQCgoVXH 7NSGIvkBuGaiSy3KQqvNE6Q= =zyOP -----END PGP SIGNATURE----- --ZwgA9U+XZDXt4+m+--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031121183154.GC74629>