当前位置:网站首页>Anonymous structure in C language
Anonymous structure in C language
2022-07-05 08:05:00 【Car chezi】
stay C Of C11 In the standard , Added anonymous structure and anonymous union .
Anonymous Union / Structures are also known as unnamed unions / structure , Because there is no name , Therefore, their direct objects will not be created ( Or variable ), Usually we use them in nested structures or unions .
An anonymous struct declaration is a declaration that declares neither a tag for the struct, nor an object or typedef name. Anonymous structs are not allowed in C++.
give an example :
// C Program to demonstrate working of anonymous struct
#include <stdio.h>
struct scope
{
// Anonymous structure
struct
{
char alpha;
int num;
};
};
int main(void)
{
struct scope x;
x.num = 65;
x.alpha = 'B';
// Note that members of structure are accessed directly
printf("x.alpha = %c, x.num = %d\n", x.alpha, x.num);
return 0;
}
Reference material :
【1】https://www.geeksforgeeks.org/g-fact-38-anonymous-union-and-structure/
【2】https://docs.oracle.com/cd/E19205-01/819-5267/bkael/index.html
边栏推荐
- Drive LED -- GPIO control
- Reasons for rapid wear of conductive slip rings
- Ads learning record (lna_atf54143)
- Explication de la procédure stockée pour SQL Server
- C WinForm [change the position of the form after running] - Practical Exercise 4
- 如何进行导电滑环选型
- Sql Server的存储过程详解
- Measurement fitting based on Halcon learning [III] PM_ measure_ board. Hdev routine
- Train your dataset with yolov4
- Consul installation
猜你喜欢
![C WinForm [exit application] - practice 3](/img/25/30c795cc3fa6931eb1d733719d4ad0.jpg)
C WinForm [exit application] - practice 3

My-basic application 2: my-basic installation and operation
![Measurement fitting based on Halcon learning [i] fuse Hdev routine](/img/91/34c92065e797c87d6ce5ea13903993.jpg)
Measurement fitting based on Halcon learning [i] fuse Hdev routine

Some thoughts on extracting perspectives from ealfa and Ebeta

UEFI development learning 6 - creation of protocol
![Halcon's practice based on shape template matching [2]](/img/70/3e905661785e570fb406b8e97d41e6.jpg)
Halcon's practice based on shape template matching [2]

LED display equipment records of the opening ceremony of the Beijing Winter Olympics
![[tutorial 15 of trio basic from introduction to proficiency] trio free serial communication](/img/08/7f28008a4aa999650998ba8dee5d8e.jpg)
[tutorial 15 of trio basic from introduction to proficiency] trio free serial communication

Carrier period, electrical speed, carrier period variation

C language enhancement -- pointer
随机推荐
研究發現,跨境電商客服系統都有這五點功能!
[tutorial 15 of trio basic from introduction to proficiency] trio free serial communication
Development tools -- gcc compiler usage
Fundamentals of C language
Some errors in configuring the environment
Basic information commands and functions of kernel development
The printer encountered an abnormal configuration problem 0x8007007e (win10)
[trio basic tutorial 16 from introduction to proficiency] UDP communication test supplement
Soem EtherCAT source code analysis attachment 1 (establishment of communication operation environment)
Shell脚本基本语法
General makefile (I) single C language compilation template
Record the visual shock of the Winter Olympics and the introduction of the screen 2
Global and Chinese market of quenching furnaces 2022-2028: Research Report on technology, participants, trends, market size and share
万字详解八大排序 必读(代码+动图演示)
My-basic application 2: my-basic installation and operation
Global and Chinese market of core pallets 2022-2028: Research Report on technology, participants, trends, market size and share
How to migrate the device data accessed by the RTSP of the easycvr platform to easynvr?
Interview catalogue
Global and Chinese market of urban rail connectors 2022-2028: Research Report on technology, participants, trends, market size and share
Win10 shortcut key