小囡是什么意思| 自缢死亡是什么意思| 什么什么归赵| xo是什么酒| 正名是什么意思| 12月2号什么星座| 蜗牛吃什么| 口干口臭是什么原因引起的| 什么是手卫生| 独善其身是什么意思啊| 去皱纹用什么方法最好和最快| herry是什么意思| 马上风是什么意思| 预谋是什么意思| 狗是什么意思| 意思是什么意思| 带蜜蜡有什么好处| 黑米是什么米| 正畸和矫正有什么区别| 伤口恢复吃什么好得快| 什么减肥药最安全| 小猫为什么一直叫| 什么生肖最旺鸡| 白细胞减少是什么原因| 什么笔不能写字| sansay是什么牌子| 为什么喝绞股蓝会死亡| 格色是什么意思| 废品收入计入什么科目| 欧舒丹属于什么档次| 幺蛾子是什么意思| 什么茶下火| 做脑ct挂什么科| 什么油好| 老睡不醒是什么原因| 木日念什么| 什么是abs| 黄体破裂是什么意思| 诗五行属性是什么| 深圳居住证有什么用| 985是什么意思| 乙肝表面抗体偏高是什么意思| 下眼袋大是什么原因引起的| 健字五行属什么| 为什么手脚冰凉还出汗| 把脉左右手代表什么| 执业医师是什么意思| 痤疮是什么东西| 怀孕了胃不舒服是什么原因| 八八年属什么生肖| 什么是人乳头瘤病毒| 惊雷是什么意思| 君子兰什么时候开花| 吃杏有什么好处| 做恐怖的梦预示着什么| 茯苓有什么功效| 6月20是什么星座| 宝宝在肚子里打嗝是什么原因| 妇科炎症小腹坠痛吃什么药| 决定的近义词是什么| 馒头逼是什么意思| 头皮毛囊炎用什么药| 老是头晕是什么原因| 为什么女人阴唇会变大| 轻度三尖瓣反流是什么| 广州有什么好吃的| 笔记本电脑什么品牌好| 夜游神是什么意思| 小腿痒痒越挠越痒是什么原因| 虾滑是什么| 人为什么要死| 世界上最长的单词是什么| 性格好是什么意思| 2010年是什么年| 刘的五行属什么| 声嘶力竭是什么意思| 耳石症是什么| 07属什么生肖| 太阳穴痛什么原因| 恶寒什么意思| 低血压平时要注意什么| 老年人脚肿是什么原因引起的| primark是什么牌子| b2b是什么| 奴役是什么意思| 头大是什么原因造成的| 梦见生了个孩子是什么意思| 是什么星座| 血吸虫是什么动物| 荷花什么生肖| 百花齐放是什么生肖| 口加至念什么| 四平八稳是什么意思| 魔芋丝是什么做的| 慎重考虑是什么意思| 大便绿色的是什么原因| 骨皮质断裂是什么意思| 靶器官是什么意思| 交公粮是什么意思| 02年是什么年| 新陈代谢慢吃什么药| 8月31日什么星座| Continental什么牌子| 睡觉时胳膊和手发麻是什么原因| 灵隐寺求什么最灵| cot是什么| 手足口病疫苗什么时候打| 恍惚是什么意思| 手脚麻木吃什么药| 直接胆红素偏低是什么原因| 肉桂是什么味道| esrd医学上是什么意思| 水瓶座前面是什么星座| 滥情什么意思| 抑郁到什么程度要吃氟西汀| 嘴唇神经跳动是什么原因| m倾向是什么意思| 感冒为什么会咳嗽| 什么是性质| 高血糖吃什么水果最好| 皿是什么意思| 华丽转身是什么意思| 手淫过度会导致什么| 试金石什么意思| 封神榜是什么意思| 肌肉痛是什么原因| 26岁属什么的生肖| 智齿是什么原因引起的| 5月份是什么星座| 喝什么茶减肥最有效| xgrq是什么烟| 安徽菜属于什么菜系| 月经血块多是什么原因| 项羽字什么| 晚上8点是什么时辰| 性交是什么| 艾滋病前期有什么症状| 为什么会低血糖| 卸妆用什么最好| 去化是什么意思| 增大摩擦力的方法有什么| 考研要考什么| 高三学生吃什么补脑抗疲劳| 女同是什么| 色拉油是什么油| 落拓是什么意思| 孩子睡觉咬牙齿是什么原因引起的| 无所不用其极是什么意思| 薄凉是什么意思| 11.24是什么星座| 大连机场叫什么| 尿酸高看什么科| 平均血小板体积偏高是什么意思| 鼻窦炎的症状是什么| 坐月子吃什么水果| 9月30日是什么纪念日| 7d是什么意思| 夜间盗汗是什么原因| 执念什么意思| 什么是呆账| her是什么意思| 什么样的长城| 早餐吃什么最好| 猫怕什么声音| 生理需要是什么意思| 巴氏杀菌是什么意思| 性格好是什么意思| 一个王一个八念什么| 头三个月保胎喝什么汤| 孕妇梦见大蟒蛇是什么意思| 左侧头疼是什么原因引起的| 擤鼻涕带血是什么原因| 乡镇镇长什么级别| 汗疱疹用什么药膏最好| 9-11点是什么时辰| 6月6是什么星座| 肾炎什么症状| 男同是什么| i是什么| 三个羊是什么字| 尿比重偏低是什么原因| 水瓶座前面是什么星座| 什么人一年只工作一天| 胆固醇偏高有什么危害| 肺积水有什么症状| 眼皮水肿是什么原因引起的| 火车无座是什么意思| 血热吃什么药好| 望子成龙是什么意思| 来忘掉错对来怀念过去是什么歌| 早餐应该吃什么| 洧是什么意思| 万箭穿心是什么意思| 吃什么上火| 奴才是什么意思| 似乎是什么意思| 苦海无涯回头是岸是什么意思| 突然头晕恶心是什么原因| 摄入是什么意思| 肝s4钙化灶是什么意思| 马拉色菌毛囊炎用什么药治疗最好| 耳朵痒是什么原因引起的| 列装是什么意思| warrior是什么牌子| 逆水行舟什么意思| 眼底出血吃什么药| 射手座和什么座最配| 充电宝充电慢是什么原因| 婴儿便便是绿色的是什么原因| 凛冽是什么意思| 体检要带什么| 蛤蚧是什么| 咽喉老有痰是什么原因| 什么鲜花填动词| 发腮是什么意思| 72岁属什么| 胰腺是什么| 异常什么意思| 多多益善的益是什么意思| 膀胱ca是什么意思| 霉菌性阴道炎用什么药效果好| 钠低是什么原因| 怀孕什么时候吃鹅蛋最好| 一什么孩子| 斑秃去医院挂什么科| 滴水观音叶子发黄是什么原因| hp是什么牌子的电脑| 为什么突然就细菌感染了| 夜尿多是什么原因| 大力是什么药| 高风亮节是什么意思| 董酒是什么香型| lily是什么牌子| 无的放矢是什么意思| 辛辣都包括什么| 2026年属什么生肖| 胆巴是什么| 茼蒿不能和什么一起吃| 女性经常手淫有什么危害| 野兽之王是什么动物| 肾阴虚吃什么| ida是什么意思| 虾青素有什么功效| 白化病是一种什么病| 居士什么意思| wh是什么颜色| 病毒性感冒吃什么药效果好| 乐高是什么| 流产有什么症状或感觉| 38妇女节送老婆什么礼物| 开小灶是什么意思| 宫颈肥大是什么原因| 虫草吃了有什么好处| 汽化是什么意思| 肩周炎用什么药好| 夫妻分房睡意味着什么| 精神科主要看什么病| 肺胃热盛吃什么中成药| 粪便隐血试验弱阳性是什么意思| 王八是什么| 心塞是什么意思| 面包用什么面粉| 什么的| 一笑倾城是什么意思| 百度Jump to content

舆情热点--青海频道--人民网

From Wikipedia, the free encyclopedia
百度 习近平总书记强调,要坚持改革决策和立法决策相统一、相衔接,做到重大改革于法有据,使改革和法治同步推进。

In the C programming language, an escape sequence is specially delimited text in a character or string literal that represents one or more other characters to the compiler. It allows a programmer to specify characters that are otherwise difficult or impossible to specify in a literal.

An escape sequence starts with a backslash (\) called the escape character and subsequent characters define the meaning of the escape sequence. For example, \n denotes a newline character.

The same or similar escape sequences are used in other, related languages such C++, C#, Java and PHP.

Value

[edit]

To demonstrate the value of the escape sequence feature, to output the text Foo on one line and Bar on the next line, the code must output a newline between the two words.

The following code achieves the goal via text formatting and a hard-coded ASCII character value for newline (0x0A). This behaves as desired with the words on sequential lines, but an escape sequence has advantages.

#include <stdio.h>
int main() {
    printf("Foo%cBar", 0x0A);
    return 0;
}

The \n escape sequence allows for shorter code by specifying the newline in the string literal, and for faster runtime by eliminating the text formatting operation. Also, the compiler can map the escape sequence to a character encoding system other than ASCII and thus make the code more portable.

#include <stdio.h>
int main() {
    printf("Foo\nBar");
    return 0;
}

Compilation

[edit]

An escape sequence changes how the compiler interprets character data in a literal. For example, \n does not represent a backslash followed by the letter n. The backslash escapes the compiler's normal, literal way of interpreting character data. After a backslash, the compiler expects subsequent characters to complete one of the defined escape sequences, and then translates the escape sequence into the characters it represents.

This syntax does require special handling to encode a backslash character – since it is a metacharacter that changes literal interpretation behavior; not the literal backslash character. The issue is solved by using two backslashes (\\) to mean one.

Escape sequences

[edit]

The following table includes escape sequences defined in standard C as well as some non-standard sequences. The C standard requires an escape sequence that does not match a defined sequence to be diagnosed – i.e., the compiler must print an error message. Regardless, some compilers define additional escape sequences.

The table shows the ASCII value a sequence maps to, however, it may map to different values based on encoding.

Escape sequence Hex value in ASCII Character represented
\a 07 Alert (Beep, Bell) (added in C89)[1]
\b 08 Backspace
\enote 1 1B Escape character
\f 0C Formfeed Page Break
\n 0A Newline (Line Feed); see below
\r 0D Carriage Return
\t 09 Horizontal Tab
\v 0B Vertical Tab
\\ 5C Backslash
\' 27 Apostrophe or single quotation mark
\" 22 Double quotation mark
\? 3F Question mark (used to avoid trigraphs)
\nnnnote 2 nnn (octal) The byte whose numerical value is given by nnn interpreted as an octal number
\xhh… hh… The byte whose numerical value is given by hh… interpreted as a hexadecimal number
\uhhhhnote 3 non-ASCII Unicode code point below 10000 hexadecimal (added in C99)[1]:?26?
\Uhhhhhhhhnote 4 non-ASCII Unicode code point where h is a hexadecimal digit

Escape

[edit]

^ The non-standard sequence \e represents the escape character in GCC,[2] clang and tcc. It was not added to the C standard because it has no meaningful equivalent in some character sets (such as EBCDIC).[1]

Newline

[edit]

Sequence \n maps to one byte, despite the fact that the platform may use more than one byte to denote a newline, such as the DOS/Windows CRLF sequence, 0x0D 0x0A. The translation from 0x0A to 0x0D 0x0A on DOS and Windows occurs when the byte is written out to a file or to the console, and the inverse translation is done when text files are read.

Hex

[edit]

A hex escape sequence must have at least one hex digit following \x, with no upper bound; it continues for as many hex digits as there are. Thus, for example, \xABCDEFG denotes the byte with the numerical value ABCDEF16, followed by the letter G, which is not a hex digit. However, if the resulting integer value is too large to fit in a single byte, the actual numerical value assigned is implementation-defined. Most platforms have 8-bit char types, which limits a useful hex escape sequence to two hex digits. However, hex escape sequences longer than two hex digits might be useful inside a wide character or wide string literal (prefixed with L):

// single char with value 0x12 (18 decimal)
char s1[] = "\x12";
// single char with implementation-defined value, unless char is long enough
char s1[] = "\x1234";
// single wchar_t with value 0x1234, provided wchar_t is long enough (16 bits suffices)
wchar_t s2[] = L"\x1234";

Octal

[edit]

^ An octal escape sequence consists of a backslash followed by one to three octal digits. The octal escape sequence ends when it either contains three octal digits, or the next character is not an octal digit. For example, \11 is an octal escape sequence denoting a byte with decimal value 9 (11 in octal). However, \1111 is the octal escape sequence \111 followed by the digit 1. In order to denote the byte with numerical value 1, followed by the digit 1, one could use "\1""1", since C concatenates adjacent string literals.

Some three-digit octal escape sequences are too large to fit in a single byte. This results in an implementation-defined value for the resulting byte.

The escape sequence \0 is a commonly used octal escape sequence, which denotes the null character, with value zero in ASCII and most encoding systems.

Universal character names

[edit]

^ ^ Since the C99 standard, C supports escape sequences that denote Unicode code points, called universal character names. They have the form \uhhhh or \Uhhhhhhhh, where h stands for a hex digit. Unlike other escape sequences, a universal character name may expand into more than one code unit.

The sequence \uhhhh denotes the code point hhhh, interpreted as a hexadecimal number. The sequence \Uhhhhhhhh denotes the code point hhhhhhhh, interpreted as a hexadecimal number. Code points located at U+10000 or higher must be denoted with the \U syntax, whereas lower code points may use \u or \U. The code point is converted into a sequence of code units in the encoding of the destination type on the target system. For example, where the encoding is UTF-8, and UTF-16 for wchar_t:

// A single byte with the value 0xC0; not valid UTF-8
char s1[] = "\xC0";
// Two bytes with values 0xC3, 0x80; the UTF-8 encoding of U+00C0
char s2[] = "\u00C0";
// A single wchar_t with the value 0x00C0
wchar_t s3[] = L"\xC0";
// A single wchar_t with the value 0x00C0
wchar_t s4[] = L"\u00C0";

A value greater than \U0000FFFF may be represented by a single wchar_t if the UTF-32 encoding is used, or two if UTF-16 is used.

Importantly, the universal character name \u00C0 always denotes the character "à", regardless of what kind of string literal it is used in, or the encoding in use. The octal and hex escape sequences always denote certain sequences of numerical values, regardless of encoding. Therefore, universal character names are complementary to octal and hex escape sequences; while octal and hex escape sequences represent code units, universal character names represent code points, which may be thought of as "logical" characters.

Alternatives

[edit]

Some languages provide different mechanisms for coding behavior that the escape sequence provide. For example, the following Pascal code writes the two words on sequential lines:

writeln('Foo');
write('Bar');

writeln outputs a newline after the parameter text, while write does not.

See also

[edit]

References

[edit]
  1. ^ a b c "Rationale for International Standard - Programming Languages - C" (PDF). 5.10. April 2003. Archived (PDF) from the original on 2025-08-05. Retrieved 2025-08-05.
  2. ^ "6.35 The Character <ESC> in Constants". GCC 4.8.2 Manual. Archived from the original on 2025-08-05. Retrieved 2025-08-05.

Further reading

[edit]
小腿麻木是什么原因 女人切除子宫有什么影响 市级三好学生有什么用 3.15什么星座 chop是什么意思
晚上睡觉流口水是什么原因 苓是什么意思 脾囊肿是什么原因引起的 四九城是什么意思 左束支传导阻滞是什么意思
尿道口发炎用什么药 男人性功能不好吃什么药 效劳是什么意思 激素六项挂什么科 射手座与什么星座最配
耄耋是什么意思 大雄宝殿供奉的是什么佛 蜜蜂蜇人后为什么会死去 酒糟是什么东西 什么是猥亵
牛奶可以做什么美食hcv9jop6ns9r.cn 喝普洱茶有什么功效hcv8jop3ns4r.cn 病符是什么意思hcv9jop3ns7r.cn 拔腋毛有什么危害hcv8jop2ns5r.cn 做凉粉用什么淀粉最好hcv8jop5ns2r.cn
自缢死亡是什么意思hcv8jop3ns9r.cn 类风湿不能吃什么食物hcv8jop6ns4r.cn 什么盐好adwl56.com 蝙蝠进屋有什么预兆hcv7jop6ns5r.cn 阴道瘙痒是什么原因hcv9jop0ns6r.cn
梦见离家出走是什么意思yanzhenzixun.com 什么地找hcv9jop4ns9r.cn 什么叫肺大泡hcv8jop3ns8r.cn 宫颈管短是什么意思hcv9jop4ns3r.cn 三观是什么hcv7jop5ns4r.cn
莲蓬什么时候成熟hcv9jop3ns5r.cn 葡萄糖是什么糖hcv8jop8ns8r.cn 月经安全期是什么时候hcv9jop6ns1r.cn 小孩老是打嗝是什么原因hcv9jop4ns8r.cn 师字五行属什么travellingsim.com
百度