| structures/point-rect-0-a.c - Et attraktivt alternativ. | Lektion 12 - slide 14 : 36 Program 2 |
#include <stdio.h>
struct point {
int x, y;
};
struct rectangle {
struct point p1, p2;
};
int main(void) {
struct point pt1 = {5,6}, pt2 = {7,8};
struct rectangle r = {pt1, pt2},
s = {{5,6}, {7,8}};
/* Printing corner points of r and s*/
printf("Corner points in r: (%d,%d) and (%d,%d)\n",
r.p1.x, r.p1.y, r.p2.x, r.p2.y);
printf("Corner points in s: (%d,%d) and (%d,%d)\n",
s.p1.x, s.p1.y, s.p2.x, s.p2.y);
return 0;
}