当前位置:网站首页>C language review 7
C language review 7
2022-06-09 07:54:00 【Sakuragi】
C Language Check 7
C Language learning , Here is a video of Weng Kai from Zhejiang University , Muke website :https://www.icourse163.org/learn/ZJU-9001?tid=9001#/learn/content. The author's review notes are also mainly based on the video . The main contents of this paper are as follows
- Programming and design C Language
- Calculation
- Judge
- loop
- Cycle control
- data type
- function
Definition and use of functions ; The parameters and variables of the function - Array
- The pointer
- character string
- Structure type
- Programming
- file
- Linked list
refer
1.
7.1 Definition and use of functions
One 、 Definition
Function is a piece of code , Receive zero or more parameters , Do one thing , Returns zero or one value .
Function definition has Return type 、 Function name 、 Parameter table 、 The body of the function . The form of the function is shown in the following figure :

Even if it is void, Finally, you'd better add return;
Two 、 Function call
When calling a function, you need to use Function name 、 Parameter table , The parameter table is used to call the function . Common calling methods are as follows :
3、 ... and 、 Function return value
The return value of the function is return Keyword implementation , He can return a number , You can also return an expression , A function can have more than one return, But in order to comply with the single export principle , It's better to have only one return.
return Is that , Can be assigned to variable , Can transfer values, etc .
7.2 The parameters and variables of the function
One 、 The function prototype
C When the compiler analyzes code from top to bottom , If in main Other function calls that occur in the function ,C The compiler will look for the definition of the function in the above to match the parameter types .
To make function calls more beautiful , We use function prototypes .
Function prototypes are usually written in function definitions and main Before the function , from Return type 、 Function name 、 The parameter table consists of , That is, the header of the function definition , Form the following :
Two 、 Function parameter
When a function is called, it always passes value .
Each function has its own variable space ( Local space / The local variable ), We call it The local variable , The opposite is Global variables , Parameters are also in this independent local variable , It has nothing to do with other functions .
3、 ... and 、 The local variable
The function produces one local variable per run .
Life span : When variables are created and die .
Scope : The range that variables can access .
For local variables , Both his lifetime and scope are in curly brackets —— block .
It should be noted that , The default initial value of the global variable is 0, Local variables have no default initial value , Some details of local variables are shown below :
边栏推荐
- 2022广东省安全员C证第三批(专职安全生产管理人员)考题及模拟考试
- Research and investment strategy report on China's FRP membrane shell industry (2022 Edition)
- Google browser F12 (developer tool) -- function introduction
- C语言复习12
- How to solve security problems in low code platforms?
- 2022 Chinese cook (elementary) examination question bank and online simulation examination
- The cumulative net worth of more than 1100 products fell below 0.8. Is the performance of private placement good this year?
- (13) Cross compilation and memory leak detection of Valgrind on ARM
- SQLZOO刷题记录-2
- Robot_ Framework: Variables
猜你喜欢

The 11th finals of the electronic single chip microcomputer of the Blue Bridge Cup

Lvs+keepalived high availability

Which software design documents are most easily ignored?

mysql常见面试知识点

ftp服务

2022 examination questions and mock examination for the third batch of Guangdong Provincial Safety Officer C certificate (full-time safety production management personnel)

Mechanical keyboard shaft (red shaft, tea shaft, black shaft, green shaft)

Question bank and answers of 2022 special operation certificate for installation and repair of refrigeration and air conditioning equipment

PostgreSQL database replication - background first-class citizen process walreceiver extracts information

2022 tower crane driver (construction special type of work) examination question simulation examination question bank and simulation examination
随机推荐
Pushmall push and paste sharing e-commerce plan update completed in May 2022
软件设计文档最容易忽略哪些?
[NewOJ Week 1]---CDE
Redis large key
MySQL recursively queries all child nodes according to the parent node, and the list to tree structure tool class
Simulated question bank and answers for the 2022 National latest fire facility operator (intermediate fire facility operator) examination
C语言复习11
Specific steps for yolov5 to add attention mechanism
A group of interesting pictures to explain the status code
Is it safe to open an account in Chang'an futures?
Simple practice of bouncing shell with NC and Bash
Question bank and answers of 2022 special operation certificate for installation and repair of refrigeration and air conditioning equipment
Robot_ Framework: common built-in keywords
Sql Or NoSql,看完这一篇你就懂了
MySQL: subquery
Pycharm and MySQL as a student information management system
error converting YAML to JSON: yaml: line 10: found character that cannot start any token
FTP service
2022制冷与空调设备安装修理特种作业证考试题库及答案
Selenium: Introduction