当前位置:网站首页>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 :
边栏推荐
- Inclination monitoring solution of Internet of things
- Basic crawler actual combat case: obtaining game product data
- 110道 MySQL面试题及答案 (持续更新)
- AES 双向加密解密工具
- Solve the problem of MSVC2017 compiler with yellow exclamation mark in kits component of QT
- User identity identification and account system practice
- Cs4344 domestic substitute for dp4344 192K dual channel 24 bit DA converter
- Detailed steps of installing MySQL 5.7 for windows
- Day13: file upload vulnerability
- Low power Bluetooth 5.0 chip nrf52832-qfaa
猜你喜欢
![[opencv] - Operator (Sobel, canny, Laplacian) learning](/img/24/4e40408b61ec2c714b750b05a534c7.png)
[opencv] - Operator (Sobel, canny, Laplacian) learning

Day15 (day16 extension): file contains vulnerability

【Transformer】SegFormer:Simple and Efficient Design for Semantic Segmentation with Transformers

谷歌浏览器免跨域配置

Time function in MySQL

Solve the problem of MSVC2017 compiler with yellow exclamation mark in kits component of QT

ROS tutorial (Xavier)

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

Stm8s003 domestic substitute for dp32g003 32-bit microcontroller chip
![[robomaster] a board receives jy-me01 angle sensor data -- Modbus Protocol & CRC software verification](/img/0e/e5be0fffb154d081c20b09832530d4.png)
[robomaster] a board receives jy-me01 angle sensor data -- Modbus Protocol & CRC software verification
随机推荐
Use SQL client How can the job generated by SH achieve breakpoint continuation after cancle?
Security baseline of network security
Markdown concise grammar manual
DC motor control system based on DAC0832
ML.NET相关资源整理
Importerror: no module named XX
Stm8s003 domestic substitute for dp32g003 32-bit microcontroller chip
Phy6252 is an ultra-low power Bluetooth wireless communication chip for the Internet of things
Proteus simulation based on msp430f2491
Back up Google or other browser plug-ins
Deep learning (1): prediction of bank customer loss
Centos7/8 command line installation Oracle11g
Eggjs create application knowledge points
Gan: generate adversarial networks
What constitutes the smart charging pile system?
Week 2: convolutional neural network basics
What is the working principle of the noise sensor?
Windows 安装 MySQL 5.7详细步骤
Day6: using PHP to write landing pages
Week 1 task deep learning and pytorch Foundation