当前位置:网站首页>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
边栏推荐
- [professional literacy] specific direction of analog integrated circuits
- C WinForm [change the position of the form after running] - Practical Exercise 4
- Soem EtherCAT source code analysis II (list of known configuration information)
- Arduino uses nrf24l01+ communication
- Explication de la procédure stockée pour SQL Server
- [trio basic from introduction to mastery tutorial 20] trio calculates the arc center and radius through three points of spatial arc
- 【论文阅读】2022年最新迁移学习综述笔注(Transferability in Deep Learning: A Survey)
- Mlperf training v2.0 list released, with the same GPU configuration, the performance of Baidu PaddlePaddle ranks first in the world
- IC software learning
- Markdown tips
猜你喜欢
Step motor generates S-curve upper computer
C WinForm [exit application] - practice 3
Introduction of air gap, etc
找不到实时聊天软件?给你推荐电商企业都在用的!
Carrier period, electrical speed, carrier period variation
L'étude a révélé que le système de service à la clientèle du commerce électronique transfrontalier a ces cinq fonctions!
How to migrate the device data accessed by the RTSP of the easycvr platform to easynvr?
Ten thousand words detailed eight sorting must read (code + dynamic diagram demonstration)
Semiconductor devices (III) FET
Communication standard -- communication protocol
随机推荐
Adaptive filter
C # joint configuration with Halcon
Imx6ull bare metal development learning 2- use C language to light LED indicator
How to select conductive slip ring
[professional literacy] core conferences and periodicals in the field of integrated circuits
UEFI development learning 4 - getting to know variable services
Hardware and software solution of FPGA key chattering elimination
Ads learning record (lna_atf54143)
UEFI development learning series
After installing the new version of keil5 or upgrading the JLINK firmware, you will always be prompted about the firmware update
Sql Server的存儲過程詳解
Shape template matching based on Halcon learning [9] PM_ multiple_ dxf_ models. Hdev routine -- [read and write XLD from DXF file]
Consul安装
Fundamentals of C language
Altium designer 19.1.18 - Import frame
Summary -st2.0 Hall angle estimation
Connection mode - bridge and net
Detailed explanation of pragma usage
Ten thousand words detailed eight sorting must read (code + dynamic diagram demonstration)
C language # and #