当前位置:网站首页>C language macro define command exercise
C language macro define command exercise
2022-07-29 08:26:00 【CPP programming】
Study C Language macro #define command .
Their thinking :C In language , It can be used #define Define an identifier to represent a constant .
Its characteristics are : The defined identifier does not occupy memory , It's just a temporary symbol , After the precompile, the symbol does not exist ; Precompiling is also called preprocessing , Precompiling is not compiling , But pre compilation processing , This operation is automatically completed by the system before formal compilation .
C Language source code demonstration :
#include<stdio.h>// The header file
#define TRUE 1// Macro variable
#define SQUARE(x) (x)*(x)// Macro definition squared function
int main()// The main function
{
int num,num_Square;// Defining integer variables
printf(" Please enter the number of squares required :");// Prompt statement
scanf("%d",&num);// Keyboard entry
num_Square=SQUARE(num);// Find the square
printf("%d The square is :%d\n",num,num_Square);// Output results
if(num_Square>50)
{
printf("%d\n",TRUE);
}
return 0;// The return value of the function is 0
}
Compile run results :
Please enter the number of squares required :8
8 The square is :64
1
--------------------------------
Process exited after 3.367 seconds with return value 0
Please press any key to continue . . .
Today's sharing is here , Everyone should study hard C Language /C++ yo ~
At the end : For preparing to learn C/C++ Programming partners , If you want to better improve your core programming skills ( Internal skill ) From now on !
C Language C++ Programming learning communication circle ,QQ Group :763855696【 Click to enter 】
C Language from entry to mastery (C Introduction to language C Language course C Language zero basis C Language foundation C Language learning C
Organize and share ( Years of learning source code 、 Project practice video 、 Project notes , Introduction to Basics )
Welcome to change careers and learn programming partners , Using more information to learn and grow faster than thinking about it yourself !
Programming learning video sharing :
边栏推荐
- Clickhouse learning (I) Clickhouse?
- Proteus simulation based on msp430f2491
- Solve the problem of MSVC2017 compiler with yellow exclamation mark in kits component of QT
- PostgreSQL manually creates hikaridatasource to solve the error cannot commit when autocommit is enabled
- Application of explosion-proof inclination sensor in safe operation of LNG
- The computer video pauses and resumes, and the sound suddenly becomes louder
- 【OpenCV】-算子(Sobel、Canny、Laplacian)学习
- Unity多人联机框架Mirro学习记录(一)
- torch.nn.functional.one_hot()
- BiSeNet v2
猜你喜欢

Pnpm install appears: err_ PNPM_ PEER_ DEP_ ISSUES Unmet peer dependencies

New energy shared charging pile management and operation platform

Flask reports an error runtimeerror: the session is unavailable because no secret key was set
![[opencv] - Operator (Sobel, canny, Laplacian) learning](/img/24/4e40408b61ec2c714b750b05a534c7.png)
[opencv] - Operator (Sobel, canny, Laplacian) learning

数仓分层设计及数据同步问题,,220728,,,,

Day4: SQL server is easy to use

深度学习(2):图片文字识别

分段分页以及段页结合

Unity multiplayer online framework mirror learning record (I)

The computer video pauses and resumes, and the sound suddenly becomes louder
随机推荐
Alibaba political commissar system - Chapter III, Alibaba political commissar and cultural docking
Collation of ml.net related resources
Smart energy management system solution
Day15: the file contains the vulnerability range manual (self use file include range)
Chrony 时间同步
Unity多人联机框架Mirro学习记录(一)
Hal library learning notes - 8 concept of serial communication
华为无线设备配置利用WDS技术部署WLAN业务
Deep learning (2): image and character recognition
DAC0832 waveform generator based on 51 single chip microcomputer
Nrf52832-qfaa Bluetooth wireless chip
Unity shader learning (VI) achieving radar scanning effect
Back up Google or other browser plug-ins
AES bidirectional encryption and decryption tool
Time function in MySQL
Ar virtual augmentation and reality
Eps32+platform+arduino running lantern
产品推广的渠道和策略,化妆品品牌推广方法及步骤
Basic crawler actual combat case: obtaining game product data
Simulation of four way responder based on 51 single chip microcomputer