当前位置:网站首页>Summary of the third class
Summary of the third class
2022-07-05 15:25:00 【Houli crab 670】
The operator
Monocular operators
There are many monocular operators , Here are just a few explanations
- sizeof
It can calculate types and variables , Such asprintf("%d\n",sizeof(int));printf("%d\n",sizeof(a));
This can be calculated , The result of running is 4( Define an integer variable a). - ++a,a++
Novices of this monocular operator often get confused , Or you don't understand the principle thoroughly , But with the accumulation of time, this kind of thing goes directly to the back , I don't think we need to go too deep , All in all , To sum up, the following two sentences .
In front of ++, First add , After use
After ++, First use , Add after
- Cast


Think of this situation , The system will have an alarm , Because it was originally a decimal , And you have to assign it to the variable of shaping , So report a mistake , Then how to solve ?
At this time, the cast type appears
This "(int)“ It means to put 3.252 Cast to Int type .
Only one more ”(int)", So the warning is gone , Does it work ?
Relational operator

What we should pay attention to here is "=“ and ”= =“ The difference between , Novices often make mistakes , I sometimes neglect it carelessly , If it is ignored, the result will be different from that expected .
The result we want to run is "eiei”, But the result is "heihei", At first glance, there seems to be no mistake , And the mistake is "=“ and ”= =“ The difference between , One is assignment , One is equal . Think about the expected results , Just think of the following .
therefore , Make a distinction between ”=“ and ”= =" The difference between .
Logical operators

There is no further study here “ Short circuit phenomenon ”( That's what our school teacher said in class ), Simply put
“&&” : If "&&“ The previous expression is false , that ”&&“ The following expression is not executed , If the following expression has assignment or other operations on variables , Then you won't be able to calculate , It will deviate from the expected results .
“||” : If ”||“ The previous expression is true , So the same ”||" The following expression will not operate , If the following expression also has the operation on variables , Then I can't calculate , There will be deviations .
This is something that some people who are good at learning programs sometimes don't notice , This leads to program errors .
Conditional operators
The conditional operator is also called the trinocular operator , yes C The only ternary operator in language , The usage is also very simple .
(exp It means expression )exp1 Set up ? Set up and Export exp2, Otherwise output exp3.
Comma expression
The comma expression is (exp1,exp2,exp3,…) Its principle is to calculate from left to right , But the result of the whole comma expression is the result of the last expression . Such as :
The result of the operation is 4
First calculate from left to right ,(c=3,b=13,d=4,4) This is how the program works , Take a look .
as for c Why did it start with 3, And then 4, This is what I said at the beginning of my article
First use , Add after
Common keywords
There are many common keywords , I won't list them one by one here , Quarks can be found on a search , Only a few keywords are described here .
- typedef
This is actually type define( The type definition ), Simply put, it is to redefine a type , Its purpose is to simplify the name of complex types , There are other people who do not adapt to this type of name can replace the name . For example, one who doesn't learn C Language people , In his language, plastic surgery is not called int, Then he can redefine .

like this , Is to redefine .
Here is the general "unsigned int" Defined as "uint", Is it a lot simpler ?
typedef+ Space + Defined type + The name of the definition
static

As shown in the figure ,static There are three usages that are not explained in depth here , Explain it in a special article .extern
Declare external symbols ( External symbols are in other source files )
Again and without further explanation , and static Put them together in an article to explain .
边栏推荐
- Reconnaissance des caractères easycr
- Hongmeng system -- Analysis from the perspective of business
- episodic和batch的定义
- No one consults when doing research and does not communicate with students. UNC assistant professor has a two-year history of teaching struggle
- The difference between SQL Server char nchar varchar and nvarchar
- Dark horse programmer - software testing -10 stage 2-linux and database -44-57 why learn database, description of database classification relational database, description of Navicat operation data, de
- Creation and optimization of MySQL index
- Crud of MySQL
- 复现Thinkphp 2.x 任意代码执行漏洞
- Want to ask the big guy, is there any synchronization from Tencent cloud Mysql to other places? Binlog saved by Tencent cloud MySQL on cos
猜你喜欢
随机推荐
P6183 [USACO10MAR] The Rock Game S
Array sorting num ranking merge in ascending order
Bugku easy_ nbt
Reconnaissance des caractères easycr
Stm32+bh1750 photosensitive sensor obtains light intensity
可视化任务编排&拖拉拽 | Scaleph 基于 Apache SeaTunnel的数据集成
Redis distributed lock principle and its implementation with PHP (1)
ICML 2022 | 探索语言模型的最佳架构和训练方法
可转债打新在哪里操作开户是更安全可靠的呢
Visual task scheduling & drag and drop | scalph data integration based on Apache seatunnel
Your childhood happiness was contracted by it
想问下大家伙,有无是从腾讯云MYSQL同步到其他地方的呀?腾讯云MySQL存到COS上的binlog
Ionic Cordova project modification plug-in
MySQL 巨坑:update 更新慎用影响行数做判断!!!
Ctfshow web entry explosion
OSI 七层模型
"Sequelae" of the withdrawal of community group purchase from the city
DVWA range clearance tutorial
Bugku's Eval
Mongdb learning notes
![P6183 [USACO10MAR] The Rock Game S](/img/f4/d8c8763c27385d759d117b515fbf0f.png)






![P1451 calculate the number of cells / 1329: [example 8.2] cells](/img/c4/c62f3464608dbd6cf776c2cd7f07f3.png)

