当前位置:网站首页>[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.
边栏推荐
- Compile Hudi
- A brief introduction to the CheckBox component of the basic components of Flutter
- The Map Entry understanding and application
- LeetCode每日一练 —— OR36 链表的回文结构
- Distributed locks and three implementation methods
- Redis实现分布式锁
- Atomic operation CAS
- Modbus on AT32 MCUs
- 【CocosCreator 3.5】CocosCreator get network status
- 【编译原理】递归下降语法分析设计原理与实现
猜你喜欢

识Flutter 基本组件之showTimePicker 方法

12 Disk related commands

【异常】The field file exceeds its maximum permitted size of 1048576 bytes.

JS function this context runtime syntax parentheses array IIFE timer delay self.backup context call apply

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

MultipartFile文件上传

A brief introduction to the CheckBox component of the basic components of Flutter

想从手工测试转岗自动化测试,需要学习哪些技能?

TCP详解(三)

Mysql 45 study notes (twenty-five) MYSQL guarantees high availability
随机推荐
Modbus on AT32 MCUs
MultipartFile file upload
[C language] Preprocessing operation
数据库实现分布式锁
[C language] Three-pointed chess (classic solution + list diagram)
SQALE 是什么
浅识Flutter 基本组件之CheckBox组件
7年经验,功能测试工程师该如何一步步提升自己的能力呢?
Analysis summary - self-use
安全20220712
2022 Nioke Multi-School League Game 4 Solution
【Exception】The field file exceeds its maximum permitted size of 1048576 bytes.
C primer plus学习笔记 —— 8、结构体
SQL injection Less54 (limited number of SQL injection + union injection)
冒泡排序、选择排序、直接插入排序、二分法查找
大小端模式
What is a distributed lock?Three ways of implementing distributed lock
TCP和UDP详解
Installation of mysql5.7.37 under CentOS7 [perfect solution]
SQL 面试用题(重点)