当前位置:网站首页>How to set priorities in C language? Elaborate on C language priorities
How to set priorities in C language? Elaborate on C language priorities
2022-07-02 19:38:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm your friend, Quan Jun .
0. Why should we master priorities
Think about these two questions :
a. Read someone else's code , I can't understand the priority problem , What do I do ?
b. A bunch of parentheses , Is it beautiful ?
I wanted to decorate the wall with a picture , But a pile of paper was used to fix !
Some people say that the code is written too much , Of course . This is a very broad statement . Look at the level of the code you write , Some things you may have been
Can't touch , What about proficiency . Some things must be combed , summary .
1. priority
1.1 Priority chart
The operator with the highest priority is not a real operator , Include : The array subscript , Function call , Structure member selector .
Monocular operators take second place .(! ~ ++ — – (type) * & sizeof)
Then there is binocular operator . In the binocular operator , Arithmetic operator (* / % + -) The highest priority , displacement (<< >>) second , Relationship
Operator (< <= > >= != ==) third , Then there is the bitwise operator (& ^ | ), Logical operators (&& ||) Conditional operator (?: Three orders ),
Assignment operator (= …).
Any logical operator has a lower priority than any relational operator .
The shift operator has a lower priority than the arithmetic operator , But higher than relational operators .
1.2 Operator instance
a. while (c = getc(in) != EOF)
putc(c, out)
Loop means copying one file to another . But because of != The priority of is higher than that of the assignment operator , therefore c
Given to getc() The return value of is the same as EOF Boolean value after comparison , The result is to out A pile of 1.
1.3 Priority doggerel
Vinegar jar sour filling
The taste falls and the blessing beans jump
common 44 Operators
vinegar - Elementary ,4 individual : ( ) [ ] -> Point to structural members . Structural members
The altar - Monocular ,9 individual : ! ~ ++ — - Minus sign ( type ) * The pointer & Address fetch sizeof length
acid - The arithmetic ,5 individual : * / % + - reduce
taste - Displacement ,2 individual : << >>
irrigation - Relationship ,6 individual : < <= > >= == be equal to != It's not equal to
taste - Bit logic ,3 individual : & Bitwise AND ^ Bitwise XOR | Press bit or
fall - Logic ,2 individual : && Logic and || Logic or
jump - Conditions ,1 individual , Three orders : ? :
blessing - assignment ,11 individual : = += -= *= /= %= >>= <<= &= ^= |=
bean - comma ,1 individual : ,
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/148556.html Link to the original text :https://javaforall.cn
边栏推荐
猜你喜欢

程序猿入门攻略(十二)——数据的存储

Refactoring: improving the design of existing code (Part 1)

Educational Codeforces Round 129 (Rated for Div. 2) 补题题解

Chic Lang: completely solve the problem of markdown pictures - no need to upload pictures - no need to network - there is no lack of pictures forwarded to others

高并发下如何避免产生重复数据?

注解开发方式下AutowiredAnnotationBeanPostProcessor的注册时机

守望先锋世界观架构 ——(一款好的游戏是怎么来的)

zabbix5客户端安装和配置

Windows2008R2 安装 PHP7.4.30 必须 LocalSystem 启动应用程序池 不然500错误 FastCGI 进程意外退出

Zabbix5 client installation and configuration
随机推荐
Golang并发编程——goroutine、channel、sync
Gmapping code analysis [easy to understand]
Web2.0 giants have deployed VC, and tiger Dao VC may become a shortcut to Web3
IEDA refactor的用法
Bubble sort array
453-atoi函数的实现
Introduction of Ethernet PHY layer chip lan8720a
AcWing 383. 观光 题解(最短路)
Implementation of 452 strcpy, strcat, StrCmp, strstr, strchr
函数高阶-柯里化实现
AcWing 1137. 选择最佳线路 题解(最短路)
定了,就是它!
简书自动阅读
golang:[]byte转string
Golang concurrent programming goroutine, channel, sync
MySQL
MySQL table historical data cleaning summary
checklistbox控件用法总结
《重构:改善既有代码的设计》读书笔记(下)
Getting started with typescript