当前位置:网站首页>Summary of error prone knowledge points: Calculation of define s (x) 3*x*x+1.
Summary of error prone knowledge points: Calculation of define s (x) 3*x*x+1.
2022-07-03 12:33:00 【Android little white star】
This is a macro definition with parameters , Usually, the macro parameters in the macro content text are replaced with text .
Let's use this to write an example for calculation .
#define SUM(x) 3*x*x+1
int main()
{
int i=5;
int j=8;
printf("%d\n",SUM(i+j));
}
The answer from the computer is 64.
My wrong idea at the beginning is :3*(5+8)*(5+8)+1
.
But the difference between the calculated value and the actual value .
The right thinking is :SUM Don't put parentheses
Take it with you , Only the formula
Take it to .3*5+8*5+8+1
.
The calculated answer is exactly the same as the actual answer .
边栏推荐
- Itext7 uses iexternalsignature container for signature and signature verification
- 剑指Offer09. 用两个栈实现队列
- regular expression
- Introduction to concurrent programming (II)
- Self made pop-up input box, input text, and click to complete the event.
- Eureka自我保护
- Unicode encoding table download
- JVM内存模型
- Redis notes 01: Introduction
- 4000字超详解指针
猜你喜欢
随机推荐
使用BLoC 构建 Flutter的页面实例
Jsup crawls Baidu Encyclopedia
剑指Offer05. 替换空格
(database authorization - redis) summary of unauthorized access vulnerabilities in redis
Fundamentals of concurrent programming (III)
Pragma pack syntax and usage
LeetCode 0556.下一个更大元素 III - 4步讲完
剑指Offer09. 用两个栈实现队列
The future of cloud computing cloud native
Wechat applet development - page Jump transfer parameters
Integer int compare size
repo Manifest Format
Atomic atomic operation
2.6 preliminary cognition of synergetic couroutines
elastic_ L01_ summary
Togaf certification self-study classic v2.0
Shutter: about inheritedwidget
(construction notes) ADT and OOP
4000字超详解指针
Socket TCP for network communication (I)