Can C++ variables in cpp file defined as Special Symbols β

前端 未结 3 432
太阳男子
太阳男子 2021-01-21 14:11

Can we define the variable in c++/ c using special characters such as;
double ε,µ,β,ϰ;

If yes, how can this be achieved?

3条回答
  •  北恋
    北恋 (楼主)
    2021-01-21 14:38

    Yes you can use special characters, but not all of them. You can find the allowed one in the link below.

    You can find a detailed explanation on how to built identifier (with the list of unicode authorized characters) on the page Identifiers - cppreference.com.

    An identifier is, quoting,

    an arbitrarily long sequence of digits, underscores, lowercase and uppercase Latin letters, and most Unicode characters (see below for details). A valid identifier must begin with a non-digit character (Latin letter, underscore, or Unicode non-digit character). Identifiers are case-sensitive (lowercase and uppercase letters are distinct), and every character is significant.

    Furthermore, Unicode characters need to be escaped.

提交回复
热议问题