Academic Program

Nesting Structures

Nesting Structures

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
typedef struct
{
  float x;
  float y;
} point;
 
typedef struct
{
  point a;
  point b;
} line;
 
int main(void)
{
  line m;
 
  m.a.x = 1.2;
  m.a.y = 7.6;
  m.b.x = 38.5;
  m.b.y = 17.8;
  ...

NestingStructures.png