| point-rect-0.c - Basalt eksempel på structures i structures. | Lektion 9 - slide 13 : 29 Program 1 |
#include <stdio.h>
struct point {
int x;
int y;
};
struct rect {
struct point p1;
struct point p2;
};
int main(void) {
struct point pt1, pt2;
struct rect r;
pt1.x = 5; pt1.y = 6;
pt2.x = 17; pt2.y = 18;
r.p1 = pt1; r.p2 = pt2;
return 0;
}