What is the legal representation of C language character constants
C language character constants are characters enclosed in single quotes.
There are two ways to represent characters enclosed in single quotes:
Recommended learning: c language video tutorial
The first is Use the graphical symbol of the character, such as 'b', 'y', '*'.
The second is to use the ASCII code of the character to represent it
That is, start with a backslash (\), followed by the ASCII code of the character. The method is also called escape sequence representation. The specific method is:
has two forms:
1. Use the octal ASCII code of the character, expressed as: \101 Here, 101 is octal value.
2. Use the hexadecimal ASCII code value of the character, expressed as \xhh where hh is a two-digit hexadecimal value.
For example: 'A', '\101' and '\x41' all represent the same character constant.
The escape sequence representation can also be used to represent some special characters, to display special symbols or to control the output format.
For more C language related Introduction to Programming tutorials, please pay attention to the PHP Chinese website.
The above is the detailed content of What is the legal representation of character constants in C language?. For more information, please follow other related articles on the PHP Chinese website!