当前位置:网站首页>查缺补漏C语言:转义字符
查缺补漏C语言:转义字符
2022-07-19 21:16:00 【代码骑士】
对于 ASCII 编码,0~31(十进制)范围内的字符为控制字符,它们都是看不见的,不能在显示器上显示,甚至无法从键盘输入,只能用转义字符的形式来表示。不过,直接使用 ASCII 码记忆不方便,也不容易理解,所以,针对常用的控制字符,C语言又定义了简写方式,完整的列表如下:
转义字符 | 意义 | ASCII码值(十进制) |
---|---|---|
\a | 响铃(BEL) | 007 |
\b | 退格(BS) ,将当前位置移到前一列 | 008 |
\f | 换页(FF),将当前位置移到下页开头 | 012 |
\n | 换行(LF) ,将当前位置移到下一行开头 | 010 |
\r | 回车(CR) ,将当前位置移到本行开头 | 013 |
\t | 水平制表(HT) | 009 |
\v | 垂直制表(VT) | 011 |
\' | 单引号 | 039 |
\" | 双引号 | 034 |
\\ | 反斜杠 | 092 |
\n
和\t
是最常用的两个转义字符:
\n
用来换行,让文本从下一行的开头输出,前面的章节中已经多次使用;\t
用来占位,一般相当于四个空格,或者 tab 键的功能。
单引号、双引号、反斜杠是特殊的字符,不能直接表示:
- 单引号是字符类型的开头和结尾,要使用
\'
表示,也即'\''
; - 双引号是字符串的开头和结尾,要使用
\"
表示,也即"abc\"123"
; - 反斜杠是转义字符的开头,要使用
\\
表示,也即'\\'
,或者"abc\\123"
。
边栏推荐
- 乐扣乐扣澄清欠税事件:不存在欠税,将一如既往合规经营,植根中国
- 可以 DIY 装修的商城系统,你也能拥有!
- How does redis realize inventory deduction and prevent oversold?
- 渗透测试靶机实战-SQL注入getshell
- OpenMMLAB系列框架解读(基于PyTorch)
- 7 位艺术家因 NFT 而改变了自己的生活
- New research on maker Education under Information Technology
- Design of the multi live architecture in different places of the king glory mall
- Kubernetes 集群环境搭建
- Google asked Indian taggers to tag reddit comment data sets, with an error rate of up to 30%?
猜你喜欢
The interviewer asked me why the GC generational collection algorithm of JVM was so designed
可以 DIY 装修的商城系统,你也能拥有!
Do you know MySQL mvcc
史上最全的 IDEA Debug 调试技巧(超详细案例)
渗透测试靶机实战-SQL注入getshell
华为云从入门到实战 | 云速建站服务与企业主机安全服务
[Bi design teaching] how to run the program in SD card by single chip microcomputer
基于STM32HAL库ADS1256调试笔记
基于全志RK3568J的RGB和SATA功能转接模块
面試官問我JVM的GC分代收集算法為什麼這麼設計
随机推荐
Simulate the implementation library function strcat-- append a copy of the source string to the target string (understand the memory overlap problem)
Oracle使用fy_recover_data恢复truncate删除的数据
Analyzing the innovative thinking in the curriculum of maker Education
The most complete idea debug debugging skills in history (super detailed cases)
The interviewer asked me why the GC generational collection algorithm of JVM was so designed
阻力很大的舵机电流特性
行业现状令人失望,工作之后我又回到UC伯克利读博了
鸿蒙HarmonyOS 3官宣:7月27日正式发布;苹果2023年放缓部分团队招聘和支出;俄罗斯对谷歌重罚26亿元|极客头条
Analog implementation library function --strcmp (character binary comparison)
4R分析redis处理客户端请求
Dynamic memory related notes
7 月最新编程排行榜:万年不变的前三,啥时候能是头?
cookie如何测试
华为云从入门到实战 | 云速建站服务与企业主机安全服务
[C debugging] - debug C code using vs 2012 ide environment
DOM事件流
Jenkins持续集成入门到精通
云计算设计和规划安全控制措施
2022 Henan Mengxin League game 2: Henan University of technology J - sign in
【IEEE出版】2022年自然语言处理与信息检索国际会议(ECNLPIR 2022)