Chapter 3

A1: Having more than one integer type lets you choose the type best suited to a particular need. For example, you could use short to conserve space, long to guarantee storage capacity, or find that a particular type speeds up a particular calculation.
A2:
short rbis = 80;            // or short int rbis = 80;
unsigned int q = 42110;     // or unsigned q = 42110;
unsigned long ants = 3000000000;

Note

Don't count on int being large enough to hold 3000000000.

A3: C++ provides no safeguards to keep you from exceeding integer limits.
A4: The constant 33L is type long, whereas the constant 33 is type int.
A5: The two statements are not really equivalent, although they have the same effect on some systems. Most important, the first statement assigns the letter ...

Get The Waite Group's C++ Primer Plus, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.