1 typedef short COORD; 2 typedef struct Point { 3 COORD x; 4 COORD y; 5 } Point; 6 7 void add(Point* result, Point* a, Point* b) { 8 result->x = a->x + b->x; 9 result->y = a->y + b->y; 10 } 11 12 void print(Point* p) { 13 printf("(%d, %d)", p->x, p->y); 14 } 15 16 void set(Point* p, int x, int y) { 17 p->x = x; 18 p->y = y; 19 } 20 21 int main() { 22 typedef char* String; 23 String s = "x = %d\n"; 24 { 25 typedef int item; 26 item x = 3; 27 printf(s, x); 28 } 29 Point a, b, c; 30 set(&a, 1,2); 31 set(&b, 3,4); 32 add(&c, &a, &b); 33 print(&c); 34 printf(" = "); 35 print(&a); 36 printf(" + "); 37 print(&b); 38 printf("\n"); 39 return 0; 40 } 41