当前位置:网站首页>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
边栏推荐
- Altium designer learning (I)
- Process communication mode between different hosts -- socket
- The research found that the cross-border e-commerce customer service system has these five functions!
- Global and Chinese market of resistivity meter 2022-2028: Research Report on technology, participants, trends, market size and share
- Consul installation
- C language # and #
- Global and Chinese market of quenching furnaces 2022-2028: Research Report on technology, participants, trends, market size and share
- Gradle复合构建
- Sql Server的存儲過程詳解
- C WinForm [help interface - send email] - practice five
猜你喜欢
Relationship between line voltage and phase voltage, line current and phase current
C WinForm [get file path -- traverse folder pictures] - practical exercise 6
Semiconductor devices (I) PN junction
Screen record of the opening ceremony of the Beijing winter olympics 2
Shape template matching based on Halcon learning [v] find_ cocoa_ packages_ max_ deformation. Hdev routine
[tutorial 15 of trio basic from introduction to proficiency] trio free serial communication
Can't find real-time chat software? Recommend to you what e-commerce enterprises are using!
【论文阅读】2022年最新迁移学习综述笔注(Transferability in Deep Learning: A Survey)
Software designer: 03 database system
Ads learning record (lna_atf54143)
随机推荐
IC software learning
C WinForm [display real-time time in the status bar] - practical exercise 1
研究發現,跨境電商客服系統都有這五點功能!
[untitled] record the visual shock of the Winter Olympics and the introduction of the display screen
Detailed explanation of pragma usage
Bluetooth hc-05 pairing process and precautions
UEFI development learning series
[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...)
After installing the new version of keil5 or upgrading the JLINK firmware, you will always be prompted about the firmware update
solver. Learning notes of prototxt file parameters
Hardware and software solution of FPGA key chattering elimination
1089 Insert or Merge 含测试点5
C WinForm [help interface - send email] - practice five
[trio basic tutorial 16 from introduction to proficiency] UDP communication test supplement
Screen record of the opening ceremony of the Beijing winter olympics 2
Soem EtherCAT source code analysis attachment 1 (establishment of communication operation environment)
Software designer: 03 database system
[popular science] some interesting things that I don't know whether they are useful or not
Shell script basic syntax
LED display equipment records of the opening ceremony of the Beijing Winter Olympics