当前位置:网站首页>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;
}
边栏推荐
- Decimal to hexadecimal
- 自动语音识别(ASR)研究综述
- 解密函数计算异步任务能力之「任务的状态及生命周期管理」
- [untitled]
- How to remove installed elpa package
- Kwai, Tiktok, video number, battle content payment
- Rust blockchain development - signature encryption and private key public key
- Serpentine matrix
- 长度为n的入栈顺序的可能出栈顺序种数
- A real day for Beijing programmers!!!!!
猜你喜欢
Laravel8 export excel file
Threejs Internet of things, 3D visualization of farms (I)
How to solve the problem that easycvr changes the recording storage path and does not generate recording files?
Threejs rendering obj+mtl model source code, 3D factory model
如何实现实时音视频聊天功能
Use threejs to create geometry and add materials, lights, shadows, animations, and axes
【FineBI】使用FineBI制作自定义地图过程
基于TCP的移动端IM即时通讯开发仍然需要心跳保活
What is the reason why the webrtc protocol video cannot be played on the easycvr platform?
线上故障突突突?如何紧急诊断、排查与恢复
随机推荐
[thingsboard] how to replace the homepage logo
Moco is not suitable for target detection? MsrA proposes object level comparative learning target detection pre training method SOCO! Performance SOTA! (NeurIPS 2021)...
Ffmepg usage guide
Machine learning decision tree
WGS84 coordinate system, web Mercator, gcj02 coordinate system, bd09 coordinate system - brief introduction to common coordinate systems
TPG x AIDU | AI leading talent recruitment plan in progress!
直播預告 | 容器服務 ACK 彈性預測最佳實踐
首席信息官如何利用业务分析构建业务价值?
[popular science] basic knowledge of thermal design: heat dissipation analysis of 5g optical devices
技术教程:如何利用EasyDSS将直播流推到七牛云?
TPG x AIDU|AI领军人才招募计划进行中!
程序员应该怎么学数学
[phantom engine UE] realize the animation production of mapping tripod deployment
CSDN正文自动生成目录
Serpentine matrix
Fonction (sujette aux erreurs)
Sword finger offer 07 Rebuild binary tree
Threejs factory model 3DMAX model obj+mtl format, source file download
mysql的七种join连接查询
How to get the first few pieces of data of each group gracefully