August 2001
Beginner
482 pages
10h 52m
English
| Q1: | If a short int can run out of room, why not always use long integers? |
| A1: | Both short integers and long integers will run out of room, but a long integer will do so with a much larger number. However, on most machines a long integer takes up twice as much memory every time you declare one. Frankly, this is less of a problem than it used to be, because most personal computers now come with many thousands (if not millions) of bytes of memory. |
| Q2: | What happens if I assign a number with a decimal to an integer rather than a
float? Consider the following line of code:
int aNumber = 5.4; |
| A2: | A good compiler will issue a warning, but the assignment is completely legal. The number you've assigned will be truncated into an integer. Thus, if you ... |
Read now
Unlock full access