当前位置:网站首页>C language learning log 11.7
C language learning log 11.7
2022-06-13 04:57:00 【Today is also a day without baldness】
One . function
(1) Function definition :
(2) Call function :
Function name ( Parameter values );
() It plays an important role in representing function calls , Even if there are no parameters ()
If there are parameters , You need to give the correct quantity and order , These values are used to initialize the parameters in the function in sequence
(3) Returns a value from a function :
return Stop the execution of the function , And return a value . It can be written. return; It means that the execution of the function is stopped without returning the value .
return expression ; return You can also use multiple .
(4) Functions that do not return values :
Format :void Function name ( Parameter table ) requirement :1. Cannot use with value return
2. There can be no return
3. The return value cannot be assigned when calling
(5) The local variable :
Lifetime of variables : When does this variable start to appear , When will it die .
Scope : stay ( Code ) What scope can access this variable ( This variable can work )
For local variables , The answers to these two questions are unified : In braces ,( Braces are also called “ block ”)
Of local variables The rules :1. It is defined within a block —— Can be in a function block ; It can also be in a statement block ; You can even pull a pair of braces to define variables .
2. Before the program runs into this block , The variables are nonexistent , Get out of this block , The variables are gone .
3. Variables defined outside the block are still valid inside .
4. A variable with the same name as the outside is defined in the block, which masks the outside .
5. A variable with the same name cannot be defined in the same block .
6. Local variables are not initialized by default .
(6) Something special :
1. When the function has no arguments : It should be expressed as void f(void); If void f(); It means f The parameter table of the function is unknown , It does not mean that there are no parameters
2. Functions cannot be nested inside .
边栏推荐
- Use service worker to preferentially request resources - continuous update
- Internet people a few years ago vs Internet people today
- Sampo Lock
- Must know must know -c language keywords
- josephus problem
- General communication protocol for industrial Internet
- [try to hack] upload labs (temporarily write to 12)
- Third party comment plugin
- 2021tami/ image processing: exploiting deep generative priority for versatile image restoration and manipulation
- OpenCV中的saturate操作(饱和操作)究竟是怎么回事
猜你喜欢
Win8.1和Win10各自的优势
Section 7 - structures
Section 5 - Operator details
Gradient descent, learning rate
LeetCode第297场周赛(20220612)
[leetcode]- binary search
Design system based on MVC using javeswingjdbc
Analysis on the usage, response and global delivery of provide/inject
[JS solution] leedcode 117 Populate the next right node pointer II for each node
QT client development -- driver loading problem of connecting to MySQL database
随机推荐
小C的记事本
2021TPAMI/图像处理:Exploiting Deep Generative Prior for Versatile Image Restoration and Manipulation
RMQ、LCA
Recommended temporary online image compression tool
Win8.1和Win10各自的优势
Converting MySQL data to PostgreSQL with Navicat
Regular expressions in QT
Construction problem of D Xiaohong
Blockly learning ----2 Code generation, grid, scaling, events, storage
Ruoyi cloud startup tutorial (hand-held graphics)
Avantages de win8.1 et win10
Tita: Xinrui group uses one-to-one talk to promote the success of performance change
[untitled]
Section 3 - functions
Cesium:cesiumlab makes image slices and loads slices
2022 oxidation process operation certificate examination question bank and simulation examination
Section 7 - structures
D 小红的构造题
利用Javeswingjdbc基於mvc設計系統
General communication protocol for industrial Internet