当前位置:网站首页>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 .
边栏推荐
- JS topic - console log()
- 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
- Array sorting num ranking merge in ascending order
- Redis distributed lock principle and its implementation with PHP (1)
- wxml2canvas
- I include of spring and Autumn
- How to introduce devsecops into enterprises?
- Leetcode: Shortest Word Distance II
- Bugku alert
- Can gbase 8A view the location of SQL statement history?
猜你喜欢

爱可可AI前沿推介(7.5)
![P6183 [USACO10MAR] The Rock Game S](/img/f4/d8c8763c27385d759d117b515fbf0f.png)
P6183 [USACO10MAR] The Rock Game S

Bugku alert

lv_font_conv离线转换

Behind the ultra clear image quality of NBA Live Broadcast: an in-depth interpretation of Alibaba cloud video cloud "narrowband HD 2.0" technology

你童年的快乐,都是被它承包了

计算中间件 Apache Linkis参数解读

NBA赛事直播超清画质背后:阿里云视频云「窄带高清2.0」技术深度解读

I spring and autumn blasting-1

做研究无人咨询、与学生不交心,UNC助理教授两年教职挣扎史
随机推荐
Bugku's steganography
Leetcode: Shortest Word Distance II
Number protection AXB function! (essence)
ionic cordova项目修改插件
CSRF, XSS science popularization and defense
What are the domestic formal futures company platforms in 2022? How about founder metaphase? Is it safe and reliable?
The difference between abstract classes and interfaces in PHP (PHP interview theory question)
Magic methods and usage in PHP (PHP interview theory questions)
30岁汇源,要换新主人了
Optional parameters in the for loop
mapper. Comments in XML files
MySQL之CRUD
JS bright blind your eyes date selector
Ten billion massage machine blue ocean, difficult to be a giant
Bugku cyberpunk
The elimination strategy of redis
P6183 [USACO10MAR] The Rock Game S
R 熵权法计算权重及综合得分
Machine learning notes - gray wolf optimization
GPS original coordinates to Baidu map coordinates (pure C code)