#include <stdio.h>
struct point {
double x;
double y;
};
void mid(struct point *p1, struct point *p2, struct point *p){
p->x = (p1->x + p2->x) / 2.0;
p->y = (p1->y + p2->y) / 2.0;
}
/* 「p1->x」は、「(*p1).x」の略記。(教科書 P.301) */
int main(void){
struct point point_a = {1.0, 2.0};
struct point point_b = {4.0, 6.0};
struct point point_c = {0.0, 0.0};
printf("%lf %lf\n", point_c.x, point_c.y);
mid(&point_a, &point_b, &point_c);
printf("%lf %lf\n", point_c.x, point_c.y);
return(0);
}