当前位置:网站首页>[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.
边栏推荐
- Day32 LeetCode
- Map.Entry理解和应用
- WebSocket Session为null
- IIR filter and FIR filter
- What skills do I need to learn to move from manual testing to automated testing?
- 点云DBSCAN聚类(MATLAB,非内置函数)
- With 7 years of experience, how can functional test engineers improve their abilities step by step?
- SQL injection Less46 (injection after order by + rand() Boolean blind injection)
- Good place to download jar packages
- 注解用法含义
猜你喜欢
Addition and Subtraction of Scores in LeetCode Medium Questions
5. How does the SAP ABAP OData service support the $filter operation
Mysql 45 study notes (23) How does MYSQL ensure that data is not lost
Mysql 45讲学习笔记(二十四)MYSQL主从一致
IIR滤波器和FIR滤波器
Local area network computer hardware information collection tool
浅识Flutter 基本组件之CheckboxListTile组件
Mysql 45 study notes (twenty-five) MYSQL guarantees high availability
SQL injection Less46 (injection after order by + rand() Boolean blind injection)
LeetCode每日一练 —— 138. 复制带随机指针的链表
随机推荐
浅识Flutter 基本组件之showDatePicker方法
安全20220712
CefSharp入门-winform
Implementation of a sequence table
Addition and Subtraction of Scores in LeetCode Medium Questions
Recursive query single table - single table tree structure - (self-use)
STM32 problem collection
Compile Hudi
els block to the left to move the conditional judgment
[Dynamic programming] Maximum sum of consecutive subarrays
安全20220722
【C语言】求两个整数m和n的最大公因数和最小公倍数之和一般方法,经典解法
Redis implements distributed locks
CloudCompare & PCL calculate the degree of overlap between two point clouds
Redis实现分布式锁
STM32问题合集
TCP/IP four-layer model
[Compilation principle] Design principle and implementation of recursive descent parsing
VS QT——ui不显示新添加成员(控件)||代码无提示
想从手工测试转岗自动化测试,需要学习哪些技能?