Largest possible value of Integer Constants

N

Nicholas

How can I get the largest possible value of the Integer Constants and use it
in the program for these types:
1. int
2. long
3. unsigned short

Thanks
 
B

Bertrand Mollinier Toublet

Tom said:
Nicholas wrote:




#include <limits.h>

INT_MAX, LONG_MAX, USHRT_MAX. And many more.

See http://www-ccs.ucsd.edu/c/limits.html .
To the OP: also note that if portability is one of your objectives, you
will want to use the minimal required values for those limits as
specified in the ISO C standard (e.g. 65536 for UINT_MAX, etc.).
Tom: nitpick. Your sig block looks ok, but is not (else it would have
been automatically cut away by my newsreader...): you need to have an
additional space character after those two dashes that start your sig block.

--
Bertrand Mollinier Toublet
"In regard to Ducatis vs. women, it has been said: 'One is a sexy thing
that you've just got to ride, even if it breaks down a lot, costs a lot
of money, and will probably try to kill you'. However, nowadays I can't
seem to remember which one is which." -- Peer Landa
 
T

Tom Zych

Bertrand said:
Tom: nitpick. Your sig block looks ok, but is not (else it would have
been automatically cut away by my newsreader...): you need to have an
additional space character after those two dashes that start your sig block.

Ah. I wondered why that space was there. Is that in an RFC or
something?
 
D

Dan Pop

In said:
Tom: nitpick. Your sig block looks ok, but is not (else it would have
been automatically cut away by my newsreader...): you need to have an
additional space character after those two dashes that start your sig block.

Maybe he has, but his posting software was written in C ;-)

Whether space characters that are written out immediately before a
new-line character appear when read in is implementation-defined.

Requiring a space right before the end of the line in the sig block
separator was a brain dead idea in the first place. The posting software
I've used until this year simply dropped that space.

Dan
 
T

Tom Zych

Dan said:
Whether space characters that are written out immediately before a
new-line character appear when read in is implementation-defined.

Are you saying that's part of the C standard? In what context?
It's hard to believe that's part of the standard - what if binary
data happens to contain \x20\x0a?

Anyway, my posting software (Netscape) isn't at fault. It precedes
a sig with "-- \n". I put "--\n" inside my sig block to separate
the sig I use for email from the sig I use when spammers will see
it.
 
B

Ben Pfaff

Tom Zych said:
Are you saying that's part of the C standard? In what context?
It's hard to believe that's part of the standard - what if binary
data happens to contain \x20\x0a?

It only applies to text streams, not binary streams.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,079
Messages
2,570,574
Members
47,206
Latest member
Zenden

Latest Threads

Top