当前位置:网站首页>[C language] General method of expression evaluation
[C language] General method of expression evaluation
2022-07-31 03:19:00 【rookieﻬ°】
How expressions are evaluated:
- The expression is evaluated to see if there is a shaping promotion or arithmetic conversion, and then the calculation is performed
- When the expression is actually calculated, first look at the priority of the adjacent operators to decide who is calculated first
- In the case of the same priority of adjacent operators, the calculation order is determined by the associativity of the operators
Of course, bad input methods will cause the program to have multipleAs a result, we should therefore write the calculation formula without an uprising.For example, the following code has different results in different compilation environments:
#include int main(){int i = 1;int ret = (++i)+(++i)+(++i);printf("ret = %d\n", ret);return 0;}Different compilation environments can get the following results:
- 10
- 12
- 9
Therefore, we must pay attention to develop a good code input method.
边栏推荐
- VS QT - ui does not display newly added members (controls) || code is silent
- Redis implements distributed locks
- CefSharp入门-winform
- 【HCIP】ISIS
- Map.Entry理解和应用
- Mysql 45讲学习笔记(二十三)MYSQL怎么保证数据不丢
- Observer pattern
- 【C语言】进制转换一般方法
- 3.5 】 【 Cocos Creator slow operating system to stop all animations
- LeetCode简单题之找到和最大的长度为 K 的子序列
猜你喜欢

Several common errors when using MP

MultipartFile文件上传

Mysql 45讲学习笔记(二十三)MYSQL怎么保证数据不丢

SQL injection Less46 (injection after order by + rand() Boolean blind injection)

Mycat's master-slave relationship, vertical sub-database, horizontal sub-table, and detailed configuration of mycat fragmented table query (mysql5.7 series)

STM32 problem collection

数据库实现分布式锁

What skills do I need to learn to move from manual testing to automated testing?

How to develop a high-quality test case?

Problems that need to be solved in distributed system architecture
随机推荐
TCP和UDP详解
测试中的误报和漏报同样的值得反复修正
addressable in Golang
els block to the right
Mysql 45讲学习笔记(二十三)MYSQL怎么保证数据不丢
Ambiguous method call.both
Thesis framework of the opening report
LeetCode每日一练 —— OR36 链表的回文结构
递归查询单表-单表树结构-(自用)
SQL injection Less54 (limited number of SQL injection + union injection)
Chapter 9 SVM Practice
QML的使用
LeetCode simple problem to find the subsequence of length K with the largest sum
【异常】The field file exceeds its maximum permitted size of 1048576 bytes.
WebSocket Session为null
IDEA comment report red solution
Modbus on AT32 MCUs
Detailed explanation of TCP (2)
TCP详解(三)
How to develop a high-quality test case?