integer and long max/min values

Vijay.Singh at nokia.com Vijay.Singh at nokia.com
Fri Nov 21 09:53:59 PST 2003


Write a simple C program to ++ an int or long variable and see when it overflows.

> -----Original Message-----
> From: owner-freebsd-hackers at freebsd.org
> [mailto:owner-freebsd-hackers at freebsd.org]On Behalf Of ext 
> Tim Kientzle
> Sent: Friday, November 21, 2003 12:24 AM
> To: Jay Sern Liew
> Cc: freebsd-hackers at freebsd.org
> Subject: Re: integer and long max/min values
> 
> 
> 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
> 
> _______________________________________________
> freebsd-hackers at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to 
> "freebsd-hackers-unsubscribe at freebsd.org"
> 


More information about the freebsd-hackers mailing list