当前位置:网站首页>C language operator priority formula
C language operator priority formula
2022-06-23 06:54:00 【zetor_ major】
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 ( Combination direction : From right to left )
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 : ? : ( Combination direction : From right to left )
blessing - assignment ,11 individual : = += -= *= /= %= >>= <<= &= ^= |= ( Combination direction : From right to left )
bean - comma ,1 individual : ,
There are only three types of combinations from right to left : assignment 、 Monocular and trinocular , The others are from left to right .
Be careful : I wrote the program today The priority of relational operation symbols and bit logic is reversed . Try to use parentheses , There's no problem .
Such as :if(P1OUT&BIT0==0)P1OUT ^=BIT0; // Judge p1.0 Whether the output is 0, Yes, just flip , On LED.
This line of program is wrong . You can put parentheses around , namely if((P1OUT&BIT0)==0), Or directly :P1OUT|=BIT0;
The operator with the highest priority is not really an operator , They are a special kind of operation .() It's about functions ,[] Array related , and -> And . It's structural members .
The second is the unary operator , All unary operators have the same priority , So in my opinion In real operators, they have the highest priority , And because they are Combined from right to left , therefore *p++ And *(p++) There is no doubt about equivalence .
Next comes the arithmetic operator ,*、/、% Of course, the priority is higher than +、- High .
The shift operator follows .
In the next relational operator ,< <= > >= than == != A higher level , It's not easy to understand .
All logical operators have different priorities ( Monocular operators go out ,! and ~)
Of logical bitwise operators " And " Than " or " high , and " Exclusive or " Between them .
Followed by && Than || high .
Next is the conditional operator , Assignment operator and comma operator .
stay C In language , Only 4 An operator specifies the direction of the operation , They are &&、| |、 Condition operator and assignment operator .
&&、| | We all calculate the value of the expression on the left first , When the value of the left expression can determine the value of the whole expression , The value of the expression on the right is no longer evaluated . Such as a = 0 && b; && The left bit of the operator 0, Then the expression on the right b No longer judge .
In the conditional operator . Such as a?b:c; First judge a Value , According to a The value of is right b or c One of them is evaluated .
The assignment expression specifies that the expression on the right is evaluated first , So make a = b = c = 6; Make it possible .
边栏推荐
- 项目_过滤器Filter解决中文乱码
- Chrome删除重复书签
- What are the pension financial products in 2022? Low risk
- 2121. sum of intervals of the same elements - hash table method
- asp.net文件下载demo与相关问题的处理
- Easy EDA learning notes 09 esp32-wroom-32e module esp32-devkitc-v4 development board one click download circuit
- Termux
- WPF Command指令和INotifyPropertyChanged
- haas506 2.0开发教程-高级组件库-modem.sms(仅支持2.2以上版本)
- Storage mode of data in memory (C language)
猜你喜欢

Sword finger offer 42 Maximum sum of successive subarrays

QT method of compiling projects using multithreading

QT中的item views与Item widgets控件的用法总结

QT设计师无法修改窗口大小,无法通过鼠标拖动窗口改变大小的解决方案

开源OAuth2框架 实现SSO单点登录

Sklearn classification in sklearn_ Report & accuracy / recall /f1 value

小白投资理财必看:图解基金买入与卖出规则

C语言学习总结

VS2013 FFMPEG环境配置及常见错误处理

Get to know webassembly quickly
随机推荐
haas506 2.0開發教程-高級組件庫-modem.sms(僅支持2.2以上版本)
30 data visualization tips that can not be ignored
中台库存中的实仓与虚仓的业务逻辑设计
剑指 Offer 42. 连续子数组的最大和
杂七杂八的东东
ssm + ftp +ueditor
Termux
mysql 索引
直播带货这么火,如何在小程序中实现视频通话及直播互动功能?
[QT] basic learning notes
Topic35——34. 在排序数组中查找元素的第一个和最后一个位置
开源OAuth2框架 实现SSO单点登录
使用ts-node直接运行TypeScript代码
Storage mode of data in memory (C language)
20220620 uniformly completely observable (UCO)
swagger3整合oauth2 认证token
Sklearn classification in sklearn_ Report & accuracy / recall /f1 value
Easy EDA learning notes 09 esp32-wroom-32e module esp32-devkitc-v4 development board one click download circuit
Programmers' real ideas | daily anecdotes
DQL、DML、DDL、DCL的概念与区别