On Fri, Nov 21, 2003 at 09:53:50AM -0800, [EMAIL PROTECTED] 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  [EMAIL PROTECTED]    [EMAIL PROTECTED]    [EMAIL PROTECTED]
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.

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to