当前位置:网站首页>My advanced learning notes of C language ----- keywords
My advanced learning notes of C language ----- keywords
2022-06-26 23:33:00 【Ana_ ing】
Preface
This is my own learning c After the foundation of language , Interested in further study , So let's start with an article to record , This time , This worst time , It is also the best time .
keyword
c Language standards define 32 Key words
keyword significance
auto Declare automatic variables , By default, the compiler generally defaults to auto
int Declare the integer variable
double Declare a double variable
long Declare a long integer variable
char Declare character variables
float Declare floating point variables
short Declare a short integer variable
signed Declare a variable of signed type
unsigned Declare an unsigned variable
struct Declare struct variables
union Declare the consortium data type
enum Declare enumeration type
static Declare static variables
switch For switch statements
case Switch statement Branch
default In the switch statement “ other ” Branch
break Jump out of current loop
register Declare register variables
const Declare read-only variable
volatile Explain that variables can be changed implicitly during program execution
typedef It is mainly used to alias data types
extern Declared variables are declared in other files
return Subroutine return statement ( With parameters , It can also be done without parameters )
void Declares that the function returns no value or takes no arguments , Declare null type pointer
continue End the current cycle , Start next cycle
do The body of a loop statement
while The loop condition of a loop statement
if Conditional statements
else Conditional statement negates Branch ( And if Continuous use )
for A circulatory body
goto Jump statements without conditions
sizeof Calculate the memory space occupied by the object
(22 Bar message ) C Language standards define 32 Key words _dengchuanjing The blog of -CSDN Blog _c Language user identifier 32 individual
https://blog.csdn.net/dengchuanjing/article/details/79265323
What is the definition , What is a statement ?
Definition is that the compiler creates an object , Allocate a heap of memory for this object and give it a name , Variable name and object name .
Statement : The first meaning is to tell the compiler , The name has been matched to a piece of memory , Next time, you can use the variable name directly , Statements can appear multiple times . The second meaning is to tell the compiler , The name has been reserved , You can't use it as a variable name anywhere else , Note that it is used as a variable name instead of . such as
int i; Definition
extern int i; Statement
Other keywords
auto
Just think he doesn't exist , The compiler defaults that all variables are auto
register
register Ask the compiler to keep variables as long as possible cpu In the internal register , Instead of searching for addresses through memory .
Fastest call
The register is ,cpu And memory module ,cpu The access speed is fast but the process cost is high
meanwhile register Variables cannot be used & To get register Variable address
static
First to speak
Static global variables : Scope is limited to the file in which the variable is defined , Other files even if used extern Statements can't use it
Static local variables : Define in function body , Can only be used in this function . Even if this function ends , The value of this static variable will not be destroyed , Function can use this value next time .
static int i;// Global variables
void fun1(void)
{
static i++;// Static local
}
Modify function , Become a static function , The advantage is that you don't have to worry about whether your defined function will have the same name as other file functions .
Basic data type

(1) Short short( In memory 2 Bytes )
yes short int Abbreviation .
Value range :-32768 ~ + 32767 (2 Bytes)
Define constants :short a = 5;
(2) integer int(long int) (4 byte )
long yes long int Abbreviation .
Value range :-2147483648 ~ +2147483647 (4 Bytes)
Definition :
int a = 0; // Definitions are best initialized
long a = 0;
// The above two definitions are the same .
(3) Long integer long long (8 byte )
PS:(1)C The language standard is stipulated as follows :int least 16 position (2 byte ),long It can't be compared with int short ,short It can't be compared with int Long , The specific bit length is determined by the compiler developer according to various situations .
(2)32 Under the platform long yes 4 Bytes ,long long yes 8 byte ; however 64 Under the bit platform, it is all 8 byte . Therefore, in order to ensure the universality of the platform , Try not to use... In the program long data type .
2、 floating-point
(1) Single precision float
The basic floating point type of the system . At least it can express exactly after the decimal point 6 Significant digits .
One float Type take up 4 Storage bits of bytes .
The highest bit is the sign bit , Then 8 Bit refers to digit , The rest 23 Bits are the last digits .
Format specifier :%f
(2) Double precision double
Double precision floating point type . At least it can express exactly after the decimal point 12 Significant digits .
One double Type take up 8 Storage bits of bytes .
The highest bit is the sign bit , Then 8 Bit refers to digit , The rest 52 Bits are the last digits .
Format specifier :%lf
(3) Character

Array
Is a series of values of the same type stored in sequence , Such as 10 individual char Type of character or 15 individual int Type value . The entire array has an array name , Accessing individual items or elements in an array through integer subscripts .
for example : The following statement :
float debts[20];// Statement debts Is a content 20 Array of elements , Each element can store float Type value . The first element of the array is debts[0], The first 2 The element is debts[1], And so on , until debts[19]. Be careful , The elements of the array are numbered from 0 Start , Not from 1 Start . Each element can be assigned float Type value .
for example , It can be written like this :debts[5] = 32.54;debts[6] = 1.2e + 21; actually , Using array elements is the same as using variables of the same type .
Structure
Is a custom composite data type . For example, this data type will be used to store student information .
Shared body
It's also called a consortium , Make several different types of variables occupy a total of memory ( Cover each other ), In other words, members of the community share a piece of memory , The data of the assigned member variable is the effective data of the community , Because the previous assignment has been overwritten . The memory occupied by the community can accommodate at least the space required for the largest member variables
边栏推荐
- Why does EDR need defense in depth to combat ransomware?
- Three solutions for improving embedded software development environment
- 不同的子序列问题I
- 让敏捷回归本源——读《敏捷整洁之道》有感
- Introduction de l'opérateur
- BS-GX-016基于SSM实现教材管理系统
- Unityeditor Editor Extension - table function
- Design of master-slave replication system
- 浅谈分布式系统开发技术中的CAP定理
- [machine learning] - Introduction to vernacular and explanation of terms
猜你喜欢
![[微服务]Eureka](/img/60/e5fa18d004190d4dadebfb16b93550.png)
[微服务]Eureka

颜色搭配和相关问题

论文解读(LG2AR)《Learning Graph Augmentations to Learn Graph Representations》

A simple and crude method for exporting R language list to local

论文学习——降雨场次划分方法对降雨控制率的影响分析

Cvpr2022 stereo matching of asymmetric resolution images

typora设置标题自动编号

Wechat applet automatically generates punch in Poster
![[微服务]认识微服务](/img/62/e826e692e7fd6e6e8dab2baa4dd170.png)
[微服务]认识微服务

12 color ring three primary colors
随机推荐
Unity4.6版本下载
Operator介绍
DAST black box vulnerability scanner part 5: vulnerability scanning engine and service capability
go语言的服务发现、存储引擎、静态网站
[微服务]Eureka
50 tips that unity beginners can definitely use
The user adds a timer function in the handler () goroutine. If it times out, it will be kicked out
Can't write to avoid killing and can easily go online CS through defender
Extensions de l'éditeur d'unityeditor - fonctions de table
Operator介紹
Introduction de l'opérateur
【710. 黑名单中的随机数】
在手机开户买股票安全吗 网上开户炒股安全吗
Is it reliable to open an account on a stock trading mobile phone? Is it safe to open an account online and speculate in stocks
The client implements client Go client type definition connection
不会写免杀也能轻松过defender上线CS
Why don't I recommend going to sap training institution for training?
股票开户有哪些优惠活动?手机开户安全么?
What are the preferential activities for stock account opening? Is it safe to open a mobile account?
Implement the queue through two stacks