Since the aggregation of words itself assumes that the types of aggregation are composed of other types.
Aggregation types C use array types and structures.
Note that the type of aggregation may include a different type of aggregation.
The following is an example of aggregation types.
#include <stdio.h> int main( void ) { struct TLine { struct TPoint { int x; int y; } first, second; } lines[10] = { [0] = { { 0, 0 }, { 10, 10 } } }; printf( "lines[%d].first = { %d, %d }, lines[%d].second = { %d, %d }\n", 0, lines[0].first.x, lines[0].first.y, 0, lines[0].second.x, lines[0].second.y ); }
Program exit
lines[0].first = { 0, 0 }, lines[0].second = { 10, 10 }
A TLine
structure is an aggregation type that contains another definition of the aggregation type of a struct TPoint
. And lines
is the object of yet another type of aggrefation - the TLines array.
source share