Can a structure contain other structures?
I would like to create a structure containing an array of four other structures. Is it possible? What does the code look like?
Yes, you can. For example, this structure S2contains an array of four objects S1:
S2
S1
struct S1 { int a; }; struct S2 { S1 the_array[4]; };
Of course, why not.
struct foo { struct { int a; char *b; } bar[4]; } baz; baz.bar[1].a = 5;
Yes, structures can contain other structures. For instance:
struct sample { int i; char c; }; struct b { struct sample first; struct sample second; };
Source: https://habr.com/ru/post/1746693/More articles:Secure form ajax POST - securityThe solution of the recurrence relation - mathWhat configuration of NetBeans IDE in PHP leads to more productive development? - phpHow can I use the profilebase class? - c #Когда удалять новый устаревший код? - refactoringOpenAL does not work when using AVAudioRecorder and AVAudioPlayer - iphoneImage Quality in LaTeX Documents - imageWhat are the most efficient MySQL column types for this data? - mysqlHow to present a three-way relationship with JPA? - javaDeveloper collaboration with Google Wave - workflowAll Articles