当前位置:网站首页>Character types of C language
Character types of C language
2022-07-04 05:08:00 【Charming】
List of articles
- 1. Basic introduction
- 2. Basic case
- 3. Character type usage details
- 4. On the nature of character type
- 5. ASCII Code introduction
- 6. ASCII Code comparison table
Character type (char)
1. Basic introduction
- Character type can represent a single character , The character type is
char,char yes 1 Bytes ( You can save letters or numbers ), Multiple characters are called strings , stay C In language Use char Array Express character string , Array is not a basic data type , It's the construction type
2. Basic case
- %c Indicates that the output is in the form of characters
void main() {
char c1 = 'A';
char c2 = '0';
char c3 = '\t';
printf("c1=%c c3=%c c2=%c", c1, c3, c2); //%c Indicates that the output is in the form of characters
getchar();
}
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.

3. Character type usage details
- Character constants are in single quotes (
' ') A single character enclosed . for example :char c1 = 'a'; char c3 = '9'; - C Escape characters are also allowed in ‘
\’ To convert subsequent characters to special character type constants .
for example :char c3 = ‘\n’; // '\n’ Means line break - stay C in ,
char The essence of Integers , At output time , yes ASCII The character corresponding to the code . - You can give it directly to
char Assign an integer , And then output , According to the corresponding ASCII Character output [97] -
char Type is computable , It's a whole number , Because it all corresponds to Unicode code . - Case presentation :

#include<stdio.h>
void main(){
char c1 = 'a';
char c2 = 'b';
// At this time, when we %c When the output , Will install ASCII Encoding table ( understand character <==> Numbers Corresponding relation ) Corresponding 97 Corresponding character output
char c3 = 97;
printf("c1=%c c2=%c c3=%c", c1, c2, c3);
getchar();
}
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.

4. On the nature of character type
- Character Store in In the computer , The code value corresponding to the character needs to be ( Integers ) To find out
Storage : character ’a’——> Code value (97)——> Binary system (1100001)——> Storage ()
Read : Binary system (1100001)——> Code value (97)——> character ’a’——> Read ( Show ) - The correspondence between character and code value is determined by character encoding table ( Yes, the rules are good )
5. ASCII Code introduction
- Inside the computer , All data is represented in binary . Every binary bit (bit) Yes 0 and 1 Two kinds of state , therefore 8 A binary bit can be combined to form 256 States , This is called a byte (byte). A byte can be used to represent 256 Different states , Each state corresponds to a symbol , Namely 256 Symbols , from 0000000 To 11111111.
- ASCII code : Last century 60 years , The United States has developed a set of character codes , The relationship between English characters and binary bits , Made a unified regulation . This is known as ASCII code .ASCII The code is specified 127 Character encoding , Such as the blank space “SPACE” yes 32( Binary system 00100000), Capital letters A yes 65( Binary system 01000001). this 128 Symbols ( Include 32 A control symbol that can't be printed ), It only takes up the end of one byte 7 position , The front of 1 Bits are uniformly specified as 0.
- Look at a complete ASCII clock
6. ASCII Code comparison table

边栏推荐
- 【MATLAB】MATLAB 仿真模拟调制系统 — AM 已调信号的功率谱与相干解调
- [matlab] matlab simulation - simulate the AM modulation process of the modulation system
- Flutter calls Gaode map app to realize location search, route planning and reverse geocoding
- 中科磐云—数据分析与取证数据包flag
- Daily question brushing record (12)
- 分享一些我的远程办公经验
- Get the ID of the record just inserted from laravel
- YoloV6实战:手把手教你使用Yolov6进行物体检测(附数据集)
- 2022年A特种设备相关管理(电梯)考试题模拟考试平台操作
- 【MATLAB】通信信号调制通用函数 — 傅里叶逆变换
猜你喜欢

中职组网络安全—内存取证

2022危险化学品经营单位安全管理人员上岗证题库及答案

定制一个自己项目里需要的分页器

抓包整理外篇fiddler———— 会话栏与过滤器
![[QT] timer](/img/df/5db6af851ef19f33fd7e7a7ed46586.png)
[QT] timer

测试 CS4344 立体声DA转换器

Technology Management - learning / practice

Sécurité du réseau dans les écoles professionnelles secondaires - preuve de mémoire

Automated testing selenium foundation -- webdriverapi

2022年R2移动式压力容器充装复训题库及答案
随机推荐
National vocational college skills competition (secondary vocational group) network security competition questions - Analysis
2022年A特种设备相关管理(电梯)考试题模拟考试平台操作
[matlab] matlab simulates digital baseband transmission system eye diagram of bipolar baseband signal (cosine roll off forming pulse)
Automated testing selenium foundation -- webdriverapi
如何使用postman实现简单的接口关联【增删改查】
Error response from daemon: You cannot remove a running container 8d6f0d2850250627cd6c2acb2497002fc3
【MATLAB】MATLAB 仿真数字基带传输系统 — 双极性基带信号(余弦滚降成形脉冲)的眼图
IP时代来临,电竞酒店如何借好游戏的“东风”?
Flutter ‘/usr/lib/libswiftCore.dylib‘ (no such file)
Zhongke Panyun - 2022 Guangxi reverse analysis ideas
自动化测试selenium基础篇——webdriverAPI
Download kicad on Alibaba cloud image station
数据标注是一块肥肉,盯上这块肉的不止中国丨曼孚科技
Secondary vocational group network security - memory Forensics
When using flash to store parameters, the code area of flash is erased, which leads to the interrupt of entering hardware error
电子元器件商城与数据手册下载网站汇总
TCP状态转换图
[matlab] matlab simulation - low pass Gaussian white noise
NTFS 安全权限
COMP1721 Creating Classes