There are two types of character constants:
One is an ordinary character, that is, enclosed in single apostrophes A character like 'b', 'y', '? '. When character constants are stored in the computer's storage unit, they are stored in their codes (usually ASCII codes). The other is escape characters, which are special character constants. The transfer character is a special form of character representation in the C language. Its meaning is to convert the character after the backslash into another meaning.
Related recommendations: "FAQ"
You need to pay attention to the following points when using character constants:
(1) Character constants can only be enclosed in single apostrophes, and single quotes or other brackets cannot be used.
(2) A character constant can only contain one character, not a string.
(3) Character constants are case-sensitive.
(4) The single apostrophe is only a delimiter and is not part of the character constant. A character constant can only be one character, excluding the single apostrophe.
(5) The single apostrophe can contain numbers, letters, and other realistic single characters in the C language character set except ' and \. However, after numbers are defined as characters, they cannot participate in numerical operations.
Legal character constants:
A. ‘\084’//Illegal, there is no 8 in octal.
B. ‘\x43’//Legal.
C. ‘ab’ //Illegal, there can only be one character.
D. ‘\0’ //Illegal, no terminator is required for the string.
Illegal character constant:
A. '\\n'
B. '\\101'
C. 'xy'
D. '\\t
The above is the detailed content of What is an illegal character constant?. 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

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

SublimeText3 Linux new version
SublimeText3 Linux latest version

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.