当前位置:网站首页>Section 7 - structures
Section 7 - structures
2022-06-13 04:47:00 【Stretch the curtain with the wind】
Catalog
1.1 Basic knowledge of structure
1.4 Structure variable definition and initialization
2. Access to structure members
1. Declaration of a structure
1.1 Basic knowledge of structure
structure Is a collection of values , These values are called member variables . Each member of a structure can be a variable of a different type
and
Array Is a collection of the same elements
The objects in life are complex
Structure is used to describe complex objects
1.2 Statement of structure
struct tag{member-list;} variable-list;
There are two ways to create structure variables :
The first way to create it :
The second way to create :
The difference between the two structure variables :
The structure variables created by the first creation method are local
The structure variables created by the second creation method are global
1.3 Type of structure member
The members of a structure can be scalars 、 Array 、 The pointer , Even other structures .
1.4 Structure variable definition and initialization
2. Access to structure members
3. Structural parameters
3.1. Value transfer call
notes : Structural variables are generally large , If you make a value passing call in the structure , A formal parameter is a temporary copy of an argument , In this case, the waste of space is serious
3.2. Address call
notes : The formal parameter pointer variable of the address transfer call stores the address of the actual parameter , It only needs 4/8 Bytes
3.3. summary
notes :
1. Any function call will apply for space in the stack area
2. The stack area will give main Function allocates a space , Access some... In this space main Local variables in functions . When a function is called , First, transfer parameters , Will be main A copy of the arguments in the function , The memory space of the copy is allocated in main Above the space occupied by the function , Then allocate a part of the memory space above the formal parameter variable to the function .
3. Similar to the stack in the data structure : Insert elements at the top of the stack , Delete elements at the top of the stack . Inserting elements at the top of the stack is called pressing the stack , Deleting elements at the top of the stack is called out of the stack . When a function passes parameters, it is similar to function stack pressing .
When a function passes parameters , Parameters need to be stacked .If you pass a structure object , The structure is too large , The system overhead of parameter stack pressing is relatively large , So it can lead to performance degradation .therefore : When structures transmit parameters , To transfer the address of the structure .
边栏推荐
- 工业互联网通用通信协议
- Infinite cycle scrolling code Alibaba international station store decoration code base map scrolling black translucent display effect custom content decoration code full screen display
- Little C's Notepad
- Tita performance treasure: remote one-on-one discussion
- PowerShell: because running scripts is prohibited on this system, the solution
- php开发14 友情链接模块的编写
- 【Try to Hack】upload-labs通关(暂时写到12关)
- 2022 ICML | Pocket2Mol: Efficient Molecular Sampling Based on 3D Protein Pockets
- 2022 ICLR | CONTRASTIVE LEARNING OF IMAGE- AND STRUCTURE BASED REPRESENTATIONS IN DRUG DISCOVERY
- Collection of some compatibility issues
猜你喜欢
How to use redis
Advantages of win8.1 and win10
Collection of wrong questions in soft test -- morning questions in the first half of 2011
Internet people a few years ago vs Internet people today
Sword finger offer 56 - I. number of occurrences in the array
josephus problem
正态分布(高斯分布)
Must know must know -c language keywords
Conception d'un système basé sur MVC avec javaswing JDBC
C # get all callable methods of WebService interface [webmethod]
随机推荐
Internet people a few years ago vs Internet people today
php安全开发15用户密码修改模块
Explain the differences and usage scenarios between created and mounted
2022 ICLR | CONTRASTIVE LEARNING OF IMAGE- AND STRUCTURE BASED REPRESENTATIONS IN DRUG DISCOVERY
Redis主从复制、哨兵模式、集群
How to lay copper in AD (aluminum designer)
Force deduction 121 questions
Introduction to applet Basics (dark horse learning notes)
shell变量学习笔记
CMB written test graphical reasoning
Design system based on MVC using javeswingjdbc
Basic syntax example for go
Avantages de win8.1 et win10
ES6 learning
PowerDesigner easy to use
E - Lucky Numbers
利用Javeswingjdbc基於mvc設計系統
Createanonymousthreadx passes parameters to anonymous threads
D 小红的构造题
2022道路运输企业安全生产管理人员操作证考试题库及答案