当前位置:网站首页>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
边栏推荐
- Makefile application
- Software designer: 03 database system
- Basic embedded concepts
- MLPerf Training v2.0 榜单发布,在同等GPU配置下百度飞桨性能世界第一
- Reasons for rapid wear of conductive slip rings
- Imx6ull bare metal development learning 2- use C language to light LED indicator
- [tutorial 15 of trio basic from introduction to proficiency] trio free serial communication
- The research found that the cross-border e-commerce customer service system has these five functions!
- Class of color image processing based on Halcon learning_ ndim_ norm. hdev
- 找不到实时聊天软件?给你推荐电商企业都在用的!
猜你喜欢
Network port usage
Record the visual shock of the Winter Olympics and the introduction of the screen 2
Altium designer 19.1.18 - hide the fly line of a network
Ten thousand words detailed eight sorting must read (code + dynamic diagram demonstration)
找不到实时聊天软件?给你推荐电商企业都在用的!
Embedded composition and route
Semiconductor devices (III) FET
Drive LED -- GPIO control
Shape template matching based on Halcon learning [viii] PM_ multiple_ models. Hdev routine
1-stm32 operation environment construction
随机推荐
Can't find real-time chat software? Recommend to you what e-commerce enterprises are using!
[tutorial 19 of trio basic from introduction to proficiency] detailed introduction of trio as a slave station connecting to the third-party bus (anybus PROFIBUS DP...)
Correlation based template matching based on Halcon learning [II] find_ ncc_ model_ defocused_ precision. hdev
Fundamentals of C language
Create inf module in AMI code
Beijing Winter Olympics opening ceremony display equipment record 3
1089 Insert or Merge 含测试点5
Screen record of the opening ceremony of the Beijing winter olympics 2
Record the opening ceremony of Beijing Winter Olympics with display equipment
Halcon's practice based on shape template matching [2]
Software designer: 03 database system
Altium designer 19.1.18 - Import frame
Step motor generates S-curve upper computer
研究发现,跨境电商客服系统都有这五点功能!
Halcon's practice based on shape template matching [1]
VESC Benjamin test motor parameters
Consul安装
LED display equipment records of the opening ceremony of the Beijing Winter Olympics
C WinForm [view status bar -- statusstrip] - Practice 2
H264 (I) i/p/b frame gop/idr/ and other parameters