当前位置:网站首页>Today, let's talk about escape characters [cute new version]
Today, let's talk about escape characters [cute new version]
2022-07-27 02:24:00 【Helinliupi he】
No addition '\' The output characters , Output characters directly
#include<stdio.h>
int main()
{
printf("a");
return 0; result :
Conclusion :
- It can be seen that , When we want to output characters , We can use it directly printf Output .
- When characters are required , It is simpler to output characters directly .
need '\' Output escape characters
Simply output characters :
#include<stdio.h>
int main()
{
printf("%c",'a');
return 0;
} result :
Conclusion : Output with escape characters is the same as direct output
Escape characters are used and calculated :
#include<stdio.h>
int main()
{
printf("%c\n",'a');
printf("%c\n",'a'-32);
return 0;
} result :
Conclusion : When it is necessary to calculate by characters , It is more convenient to use escape characters
Tips (a Of ASCII Code for 97,A Of ASCII Code is 65)
ASCII Code comparison table ( Reference resources )

It can be seen that we can use the computer to calculate different characters by the number corresponding to each character
Escape character (8 Base and 16 Base representation )
#include<stdio.h>
int main()
{
printf("%c\n",'\123'); //8 Base number
printf("%c\n",'\x33'); //16 Base number
return 0;
} result :
Conclusion :
- first 8 Hexadecimal escape character , The calculation for the :1*8^2 + 2*8 + 3 = 115 Corresponding ASCII Code for s character
- the second 16 Base escape character , The calculation for the :3*16 + 3 = 51 Corresponding ASCII Code for 3 character --> '3'
summary
- You can see it , You can output characters in different ways when you need them
- But there is character conversion or calculation , It is more convenient for us to use escape characters
边栏推荐
- 7.16 written examination of Duoyi network
- Golang - sync包的使用 (WaitGroup, Once, Mutex, RWMutex, Cond, Pool, Map)
- 怎么判断一个数是奇数还是偶数?
- Lecture 4 - explain GPIO_ Write function and related routines
- 勤写标兵——云小井
- HCIA Basics (1)
- Lora光照传感器节点数据采集
- oSPF基础实验配置
- MySQL course 1. simple command line -- simple record welcome to supplement and correct errors
- MySQL课程1.简单命令行--简单记录 欢迎补充纠错
猜你喜欢

【C语言程序设计】分支结构

Codeforces Round #796 (Div. 2), problem: (1688C) Manipulating History

Introduction to STM32 lesson 1

The latest C language introduction and advanced - the most complete and detailed C language tutorial in history!! Section 1 - overview of C language

MGRE、PPP、HDLC综合实验

动态路由ofps协议配置

微信小程序:用户微信登录流程(附:流程图+源码)

数字集成电路:CMOS反相器(一)静态特性

C language -- nesting of relational and logical operators, if statements, switch statements, and branch structures

C language - characters and strings, arithmetic operators, type conversions
随机推荐
NB-IOT接入云平台
npm报错, Error: EPERM: operation not permitted, mkdir
HCIP-第四天-OSPF路由协议
golang 实现 tcp-聊天室
TreeSet集合存储元素的问题
First acquaintance with C language (1)
动态路由配置
STM32 introductory tutorial lesson 2
静态路由综合实验
有趣的C语言
C language - assignment operator, compound assignment operator, self increasing and self decreasing operator, comma operator, conditional operator, goto statement, comment
C language implementation of the small game [sanziqi] Notes detailed logic clear, come and have a look!!
First knowledge of Web Design
CF 1333C Eugene and an array
Simple application of rip V2 (V2 configuration, announcement, manual summary, ripv2 authentication, silent interface, accelerating convergence)
oSPF基础实验配置
求解整数的每一位
SQL优化的N种方法
Codeforces Round #809 (Div. 2), problem: (C) Qpwoeirut And The City
(超详尽版,不懂随时评论)Codeforces Round #804 (Div. 2)C The Third Problem