当前位置:网站首页>[C language - zero foundation _ study _ review _ lesson 4] data types and operations
[C language - zero foundation _ study _ review _ lesson 4] data types and operations
2022-07-27 09:15:00 【Super Daxiong】
Data types and their operations
Practice every day :Int Can I provide a user identifier ?
Catalog
Data types and their operations
integer constants : That is, the integer in mathematics
There are also different types in life , For example, people 、 animal 、 Plants represent their own attributes , In the computer is no exception . stay C Data types in language include basic data types and non basic data types , Common data types include integers 、 Real type 、 Character .
Constant :
An immutable quantity in a high-level language program . for instance : Is your ID number unchanged from your birth? . So it's a constant .
Variable :
In high-level language programs , Amount that can be changed . Example : You want to eat staple food now , It can be rice 、 Steamed bread is the amount that can be changed , Become variable .
Integer data :
integer constants : That is, the integer in mathematics
octal 、 Decimal system 、 Hexadecimal
stay C In the language, we define constants without leading, and the default is decimal .012 Indicates that the octal number is preceded by 0,0xAC Indicates that the input is a hexadecimal number, and the leading is 0x perhaps o( o )x.
main() {
int a = 12;// Decimal system
int b = 045;// octal
int c = 0xAA;// Hexadecimal
printf("%d,%d,%d\n",a,b,c);// Three decimal number output
}Integer variables :
Int Become a basic heading , Of the regular compilers 4 Bytes
short Short : Occupy 2 Bytes
long Long integer : Occupy 4 Bytes
unsigned No sign ( Later, say )
We can understand variables in this way , It's equivalent to a container for storing things , In real life, we go shopping. If there are few things, we take a small shopping cart , If there are many things, take a relatively large shopping cart, which can be compared to int、long. The more bytes it occupies, the more things it can store .
C Integer constants in the language do not include binary constants
Real data :
Real data is what we call decimal in mathematics .
Real constant :
Decimal point format : By digital , The sign , The decimal point consists of .
example :-0.1,1.5,1.
The rules of composition : There must be a decimal point , At least one side of the decimal point consists of numbers , This is a bit strange , In our understanding, the decimal point should have data on both sides , But in C This is not the case in languages, such as :.5
That is to say 0.5,1. Namely 1.0. You must remember this . In the future, you can't understand what it says .
Exponential form :E And constitute the scientific counting method we have learned
for example :1.2e3 5.2e10
The rules of composition :E Both sides should be composed of arrays , The exponential part must be an integer (E The right side of is an integer )
Real variable :
Single precision :float Occupy 4 Bytes are reserved after the decimal point 8 position
Double precision :double Occupy 8 Bytes are reserved after the decimal point 16 position
float=1.12345678
double=1.12345678
Automatic data type conversion : The highest precision bit of mixed data of different types .
explain : We went to the supermarket to buy vegetables. We just started to take a small bag to hold things , Then take a big bag and put the small belt into the big bag , Whether there is space left for rotation is the rest of the big bag .
float d= 1.12345678;
double e= 1.123456789101110113;
printf("%f\n", d);
printf("%f\n", e);//%f The decimal point is reserved by default 6 position , Inadequate supplement 0, More than rounding Character data
character constants :
‘a’ ‘b’ ‘c’ Enclosed in single quotation marks , Only one byte can be stored . Cannot store Chinese characters , A Chinese character takes up two bytes .
Escape character :
Escape character | significance | ASCII Code value ( Decimal system ) |
\a | Ring the bell (BEL) | 007 |
\b | Backspace (BS) , Move the current position to the previous column | 008 |
\f | Change the page (FF), Move the current position to the beginning of the next page | 012 |
\n | Line break (LF) , Moves the current position to the beginning of the next line | 010 |
\r | enter (CR) , Move the current position to the beginning of the line | 013 |
\t | Horizontal TAB (HT) | 009 |
\v | Vertical tabulation (VT) | 011 |
\' | Single quotation marks | 039 |
\" | Double quotes | 034 |
\\ | The backslash | 092 |
Escape characters occupy one byte
\ddd:1-3 Octal representation of 1 Characters
example :’\101’ ‘\120’
\xhh: 1-2 A bit hexadecimal means 1 Characters
example :‘\xA‘ ‘\xAB’
String constant :
“abcde”
‘a‘ A character takes up a byte
“a” The string takes two bytes , because a Back by \0 We can't see .
String variable :
char a=‘b’;
char Equivalent to a container can only store one character .
边栏推荐
- Ctfshow ultimate assessment
- BEVFormer: Learning Bird’s-Eye-View Representation from Multi-Camera Images via Spatiotemporal Trans
- linux下安装oracle,本地PL/SQL连接Linux下的oracle导入表并新建用户和密码
- CUDA programming-05: flows and events
- 函数防抖节流
- 一些实用、常用、效率越来越高的 Kubernetes 别名
- Explanation of binary tree
- [I2C reading mpu6050 of Renesas ra6m4 development board]
- 5g failed to stimulate the development of the industry, which disappointed not only operators, but also mobile phone enterprises
- Babbitt | yuan universe daily must read: Guangzhou Nansha released the "Yuan universe nine" measures, and the platform can obtain up to 200million yuan of financial support
猜你喜欢

Five kinds of 3D attention/transformer finishing (a-scn, point attention, CAA, offset attention, point transformer)

npm install报错 强制安装

Explanation of common basic controls for C # form application (suitable for Mengxin)

Mangodb简单使用

Intel, squeezed by Samsung and TSMC, finally put down its body to customize chip technology for Chinese chips

CUDA Programming -03: thread level

Unity3d 2021 software installation package download and installation tutorial

BEVFormer: Learning Bird’s-Eye-View Representation from Multi-Camera Images via Spatiotemporal Trans
![[acl2020] a novel method of component syntax tree serialization](/img/24/b8ec489966f7b1deef82b2eefa4d1b.png)
[acl2020] a novel method of component syntax tree serialization

A survey of robust lidar based 3D object detection methods for autonomous driving paper notes
随机推荐
巴比特 | 元宇宙每日必读:广州南沙发布“元宇宙九条”措施,平台最高可获得2亿元资金支持...
Ctfshow ultimate assessment
5G没能拉动行业发展,不仅运营商失望了,手机企业也失望了
[daily algorithm 94] classic interview question: motion range of robot
Data interaction based on restful pages
openharmony萌新贡献指南
New year's goals! The code is more standardized!
Linux Installation and remote connection MySQL records
CUDA Programming -03: thread level
Mangodb简单使用
BEVFormer: Learning Bird’s-Eye-View Representation from Multi-Camera Images via Spatiotemporal Trans
软件测试功能测试全套常见面试题【功能测试-零基础】必备4-1
CUDA programming-02: first knowledge of CUDA Programming
[flutter -- geTx] preparation
Understand various IOU loss functions in target detection
基于ArkUI eTS开发的坚果食谱(NutRecipes
Cross domain and processing cross domain
Restful
ArkUI框架中的两个小技巧
[I2C reading mpu6050 of Renesas ra6m4 development board]