About 0 Decimal or octal problems in C + + _c language

Source: Internet
Author: User

Although in any number of systems, 0 has only one value-that is "0", the reason to ask this question, is simply idle egg pain.

Recently, talking with friends about several topics, he said, the octal number is now almost never used. I can not refute, indeed, in addition to our often used in the decimal system, the most used in the computer is binary and hexadecimal, the octal number is really "small".

When I come home carefully pondering, eight, eight, "octal is the number of 0 beginning", Yi, that 0 count? 0 is also the number beginning with 0 Ah! If 0 is octal, then we use octal numbers almost every day. There are really a lot of things in the computer to delve into, such as the simple type is actually not simple, more eggs pain computer problems can go to my "Code mystery" series to see.

So 0 is the octal number? How does the C + + specification define?

Yes, in C + +, 0 is octal.

According to C + + standard:

2.14.2 integer [Lex.icon]

Integer-literal:
Decimal-literal integer-suffixopt
Octal-literal integer-suffixopt
Hexadecimal-literal integer-suffixopt
Decimal-literal:
Nonzero-digit
Decimal-literal Digit
Octal-literal:
0 <--------------------< here >
Octal-literal Octal-digit

Later we can proudly say, "in computers, octal is more common than binary, even hexadecimal."

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.