当前位置:网站首页>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 .
边栏推荐
- Bugku's eyes are not real
- lvgl 显示图片示例
- 当代人的水焦虑:好水究竟在哪里?
- 数据库学习——数据库安全性
- Crud de MySQL
- I want to inquire about how to ensure data consistency when a MySQL transaction updates multiple tables?
- 数学建模之层次分析法(含MATLAB代码)
- 我这边同时采集多个oracle表,采集一会以后,会报oracle的oga内存超出,大家有没有遇到的?
- Optional parameters in the for loop
- Brief introduction of machine learning framework
猜你喜欢

ionic cordova项目修改插件

Bugku's eyes are not real
![[12 classic written questions of array and advanced pointer] these questions meet all your illusions about array and pointer, come on!](/img/d2/c0a19c85b2011ecd07c9944d996c4d.png)
[12 classic written questions of array and advanced pointer] these questions meet all your illusions about array and pointer, come on!

Appium自动化测试基础 — APPium基础操作API(二)

I spring web upload

Huawei Hubble incarnation hard technology IPO harvester

MySQL之CRUD

B站做短视频,学抖音死,学YouTube生?

Thymeleaf uses background custom tool classes to process text

JS knowledge points-01
随机推荐
Can gbase 8A view the location of SQL statement history?
[12 classic written questions of array and advanced pointer] these questions meet all your illusions about array and pointer, come on!
Stop B makes short videos, learns Tiktok to die, learns YouTube to live?
Reconnaissance des caractères easycr
做研究无人咨询、与学生不交心,UNC助理教授两年教职挣扎史
Good article inventory
easyOCR 字符识别
【jvm】运算指令
Go learning ----- relevant knowledge of JWT
Redis' transaction mechanism
keep-alive
mapper. Comments in XML files
Creation and use of thymeleaf template
你童年的快乐,都是被它承包了
Bugku cyberpunk
超越PaLM!北大硕士提出DiVeRSe,全面刷新NLP推理排行榜
CSRF, XSS science popularization and defense
How to paste the contents copied by the computer into mobaxterm? How to copy and paste
Common PHP interview questions (1) (written PHP interview questions)
What are the domestic formal futures company platforms in 2022? How about founder metaphase? Is it safe and reliable?