当前位置:网站首页>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
边栏推荐
- Flutter ‘/usr/lib/libswiftCore. dylib‘ (no such file)
- Two sides of the evening: tell me about the bloom filter and cuckoo filter? Application scenario? I'm confused..
- 【MATLAB】MATLAB 仿真数字带通传输系统 — QPSK 和 OQPSK 系统
- Notepad++--显示相关的配置
- TCP state transition diagram
- Share some of my telecommuting experience
- Automated testing selenium foundation -- webdriverapi
- [matlab] general function of communication signal modulation - generation of narrow-band Gaussian white noise
- cmake
- [matlab] matlab simulation modulation system - VSB system
猜你喜欢
Technology Management - learning / practice
appliedzkp zkevm(13)中的Public Inputs
2022年6月总结
Notes on the paper "cross view transformers for real time map view semantic segmentation"
Automated testing selenium foundation -- webdriverapi
Flutter ‘/usr/lib/libswiftCore.dylib‘ (no such file)
中科磐云—2022广东木马信息获取解析
Secondary vocational group network security - memory Forensics
Simulink与Arduino串口通信
【兴趣阅读】Adversarial Filtering Modeling on Long-term User Behavior Sequences for Click-Through Rate Pre
随机推荐
Introduction and application of rampax in unity: optimization of dissolution effect
中职组网络安全—内存取证
Use units of measure in your code for a better life
企业级日志分析系统ELK(如果事与愿违那一定另有安排)
拼夕夕二面:说说布隆过滤器与布谷鸟过滤器?应用场景?我懵了。。
Zhongke Panyun - data analysis and forensics packet flag
【MATLAB】MATLAB 仿真 — 模拟调制系统 之 AM 调制过程
MAUI 入门教程系列(5.XAML及页面介绍)
力扣 第 300 场周赛
分享一些我的远程办公经验
[matlab] matlab simulation - simulate the AM modulation process of the modulation system
Yyds dry goods inventory TCP & UDP
PostgreSQL has officially surpassed mysql. Is this guy too strong!
中科磐云—2022广东木马信息获取解析
[matlab] communication signal modulation general function - low pass filter
Capturing and sorting out external Fiddler -- Conversation bar and filter
cmake
Error response from daemon: You cannot remove a running container 8d6f0d2850250627cd6c2acb2497002fc3
在代码中使用度量单位,从而生活更美好
Yolov6 practice: teach you to use yolov6 for object detection (with data set)