November 2001
Beginner
1128 pages
29h 12m
English
Octal numbers are based on powers of 8, so base 8 notation uses the digits 0–7 in writing numbers. C++ uses a 0 prefix to indicate octal notation. Thus, 0177 is an octal value. You can use powers of 8 to find the equivalent base 10 value:
| 0177 (octal) | = 1×8[2] + 7×8[1] + 7×8[0] |
| = 1× 64 + 7×8 + 7×1 | |
| = 127 (decimal) |
The UNIX operating system often uses octal representation of values, which is why C++ and C provide octal notation.
Read now
Unlock full access