search
HomeCommon ProblemWhat is an illegal character constant?

What is an illegal character constant?

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.

What is an illegal character constant?

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!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SecLists

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.

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),