当前位置:网站首页>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

边栏推荐
- Get the ID of the record just inserted from laravel
- Error response from daemon: You cannot remove a running container 8d6f0d2850250627cd6c2acb2497002fc3
- We believe that the development of consumer Internet will still be limited to the Internet industry itself
- [matlab] matlab simulates digital baseband transmission system eye diagram of bipolar baseband signal (class I part response waveform)
- 2022年T电梯修理操作证考试题库及模拟考试
- 【MATLAB】MATLAB 仿真 — 窄带高斯白噪声
- TCP状态转换图
- Zhongke panyun-d module analysis and scoring standard
- Flutter calls Gaode map app to realize location search, route planning and reverse geocoding
- [paper summary] zero shot semantic segmentation
猜你喜欢

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

Notes on the paper "cross view transformers for real time map view semantic segmentation"

在代码中使用度量单位,从而生活更美好

Zhongke Panyun - module a infrastructure setting and safety reinforcement scoring standard
![[QT] timer](/img/df/5db6af851ef19f33fd7e7a7ed46586.png)
[QT] timer

关于solidworks standard无法获得许可 8544问题的总结

Fault analysis | mongodb 5.0 reports an error, and the legal instruction solves it

MAUI 入门教程系列(5.XAML及页面介绍)

Capturing and sorting out external Fiddler -- Conversation bar and filter

企业级日志分析系统ELK(如果事与愿违那一定另有安排)
随机推荐
MAUI 入门教程系列(5.XAML及页面介绍)
【MATLAB】MATLAB 仿真模拟调制系统 — AM 已调信号的功率谱与相干解调
National vocational college skills competition (secondary vocational group) network security competition questions - Analysis
Encryption and decryption
Public inputs in appliedzkp zkevm (13)
Qt QTableView数据列宽度自适应
STM32F1与STM32CubeIDE编程实例-74HC595驱动4位7段数码管
TCP状态转换图
Zhongke Panyun - data analysis and forensics packet flag
Customize a pager needed in your project
中科磐云—模块A 基础设施设置与安全加固 评分标准
NTFS security permissions
A summary of the 8544 problem that SolidWorks Standard cannot obtain a license
【MATLAB】MATLAB 仿真模拟调制系统 — DSB 系统
[matlab] matlab simulation modulation system SSB system
【MATLAB】通信信号调制通用函数 — 傅里叶变换
Headache delayed double deletion
Zkevm (12) state proof of appliedzkp
Test cs4344 stereo DA converter
企业级日志分析系统ELK(如果事与愿违那一定另有安排)