Skip to Content
C语言核心技术(原书第2版)
book

C语言核心技术(原书第2版)

by Peter Prinz, Tony Crawford
August 2017
Intermediate to advanced
798 pages
17h 44m
Chinese
China Machine Press
Content preview from C语言核心技术(原书第2版)
字面量
|
49
字面量
表3-5:八进制和十六进制转义序列的示例
八进制 十六进制 描述
'\0' '\x0'
空字符
'\033' '\x1B'
ESC控制符
'\33'
'\376' '\xfe'
十进制码为254的字符
'\417' '\x10f'
不合法
,
因为数值超过
unsigned char
类型的取值范围
L'\417' L'\x10f'
合法
!
现在它属于宽字符常量
,
类型是
wchar_t
- L'\xF82'
另一个宽字符常量
- U'\x222B'
一个宽字符常量
,
其类型是
char32_t
上表中最后两个例子没有等价的八进制表示法,因为八进制转义序列最多只能使用三个
八进制数字。同样,宽字符常量
L'\3702'
包括两个字符:
L'\370'
和
L'2'
。
3.4 字符串字面量
字符串字面量(
string literal
)由使用双引号包含的一连串字符(或者转义序列)组成。
例如:
"Hello world!\n"
对于一个字符串字面量中的单个字符,前面所描述的字符常量中的字符规则同样可以适
用。字符串字面量可以包含源代码字符集中的所有多字节字符。唯一的例外是双引号
(
"
)、反斜线(
\
)和换行符,这些都要用转义序列来表示。例如,
Windows
系统中目
录地址的每个反斜线字符都必须写成
\\
。下面
printf
语句首先产生一个警示音,然后用
引号表示了一个文件目录,采用指针参数
doc_path
指向的地址所存储的字符串字面量,
替换掉语句中的转换说明
%s
:
char doc_path[128] = ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

算法精讲视频课程:24篇系列讲座

算法精讲视频课程:24篇系列讲座

罗伯特·塞奇威克, 凯文·韦恩(Kevin Wayne)

Publisher Resources

ISBN: 9787111562207