Home > Common Problem > What is an illegal character constant?

What is an illegal character constant?

爱喝马黛茶的安东尼
Release: 2019-12-11 10:19:39
Original
35174 people have browsed it

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template