当前位置:网站首页>You Li takes you to talk about C language 7 (define constants and macros)
You Li takes you to talk about C language 7 (define constants and macros)
2022-07-05 04:24:00 【Lu Youli】
Print shaping
#define MAX 1000;
int main()
{
int a = MAX;
printf("%d\n", a);
return 0;
}
Print string
#define TAL "hi,bro!"
int main()
{
printf("%s\n", TAL);
return 0;
}
#define Defining macro
Before, we used the method of function to get the larger value between two numbers , Let's review again
Function implementation
int get_max(int x, int y)
{
int z = 0;
z = (x > y ? x : y);
return z;
}
int main()
{
int a = 50;
int b = 30;
int m = get_max(a ,b);
printf(" Larger value :%d\n", m);
return 0;
}
#define Realization
// When defining a macro , Macro names are generally capitalized
#define MAX(x, y) (x>y?x:y)
int main()
{
int a = 50;
int b = 30;
int m = MAX(a, b);
printf(" Larger value :%d\n", m);
return 0;
}
边栏推荐
- Sequelize. JS and hasmany - belongsto vs hasmany in serialize js
- level17
- Use threejs to create geometry, dynamically add geometry, delete geometry, and add coordinate axes
- WGS84 coordinate system, web Mercator, gcj02 coordinate system, bd09 coordinate system - brief introduction to common coordinate systems
- 官宣!第三届云原生编程挑战赛正式启动!
- Web开发人员应该养成的10个编程习惯
- Ctfshow 2022 Spring Festival welcome (detailed commentary)
- Network security - record web vulnerability fixes
- Common features of ES6
- 自动语音识别(ASR)研究综述
猜你喜欢
Threejs realizes the drawing of the earth, geographical location annotation, longitude and latitude conversion of world coordinates threejs coordinates
直播預告 | 容器服務 ACK 彈性預測最佳實踐
Uni app change the default component style
Is "golden nine and silver ten" the best time to find a job? Not necessarily
Threejs Internet of things, 3D visualization of farms (I)
What is the reason why the webrtc protocol video cannot be played on the easycvr platform?
Threejs factory model 3DMAX model obj+mtl format, source file download
Web开发人员应该养成的10个编程习惯
Interview related high-frequency algorithm test site 3
Kwai, Tiktok, video number, battle content payment
随机推荐
Learning MVVM notes (1)
What is the reason why the webrtc protocol video cannot be played on the easycvr platform?
[uniapp] system hot update implementation ideas
如何实现实时音视频聊天功能
指针函数(基础)
Threejs Internet of things, 3D visualization of farm (III) model display, track controller setting, model moving along the route, model adding frame, custom style display label, click the model to obt
mysql的七种join连接查询
Threejs Internet of things, 3D visualization of farms (II)
How to realize real-time audio and video chat function
About the project error reporting solution of mpaas Pb access mode adapting to 64 bit CPU architecture
Decimal to hexadecimal
Rome chain analysis
open graph协议
Machine learning -- neural network
Study notes 7
技术教程:如何利用EasyDSS将直播流推到七牛云?
Threejs factory model 3DMAX model obj+mtl format, source file download
A real day for Beijing programmers!!!!!
可观测|时序数据降采样在Prometheus实践复盘
Open graph protocol