Do you know why C language has "_" (underline)?

Source: Internet
Author: User

The C language learns that variable names can only consist of letters, numbers, underscores, and can only start with letters or underscores.

When we learn English, we all learn the hyphen ("-"), which is mainly used to connect words. So why not C language directly

Use a hyphen instead of an underscore?

Specifically looked up, found the answer.

(from Https://en.wikipedia.org/wiki/Naming_convention_ (programming))

The original is because the "hyphen" and "minus" both use the same "-", C language has been used "-" to denote a minus sign, it can not be placed in the variable name

When the hyphen is used, it is replaced with an underscore.

The above mentioned Lisp language can be used "-", because according to the Lisp grammar rules can be judged "-" represents a minus or a hyphen.

Do you know why C language has "_" (underline)?

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.