integer and long max/min values
Peter Pentchev
roam at ringlet.net
Fri Nov 21 10:48:55 PST 2003
On Fri, Nov 21, 2003 at 09:53:50AM -0800, Vijay.Singh at nokia.com wrote:
[format recovered; Tim Kientzle wrote:]
> > 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
[..and Vijay Singh wrote:]
>
> 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
--
Peter Pentchev roam at ringlet.net roam at sbnd.net roam at 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 finished reading.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20031121/0797223f/attachment.bin
More information about the freebsd-hackers
mailing list