The so-called character constant is a character enclosed in English single quotes. When using character constants, you should pay attention to:
1. Uppercase and lowercase characters within single quotes represent different character constants. For example, ‘Y’ and ‘y’ are two different character constants.
2. Character constants can only be enclosed in English single quotes, not double quotes. For example "Y" is not a character constant, but a string.
3. If there is a space character within single quotes, it is also a character constant.
4. Single quotes can only contain 1 character, and the writing of 'xyz' is wrong. But if there are more than 1 character, the previous ones except the last one will automatically become invalid. Of course, this should be avoided in programming.
5. The value of a character constant is its value in the ASCII encoding table. It is an integer from 0 to 127. Therefore, character constants can be operated as integer data. For example:
The value of the expression ‘Y’ 32 is 121, which is the value of ‘y’.
The value of expression ‘7’ ‘6’ is 109. By looking up the table, we can find that it happens to be the value of ‘m’. It should be noted that '7' and 7 are different. As a character constant, the integer constant value represented is 55, which is the integer constant 7.
The characters enclosed in single quotes include 26 uppercase and lowercase English characters, 10 numeric characters, as well as whitespace characters (space characters, tab characters, newline characters), punctuation and special symbols (on the keyboard A total of 30), they are also called the basic character set of C language
The above is the detailed content of What are character constants. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 Linux new version
SublimeText3 Linux latest version

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.
