#include <stdio.h>
typedef struct xy
{
double x, y;
} t_xy;
t_xy vec(double x, double y)
{
return ( (t_xy){x, y} );
}
t_xy operator+ (t_xy &a, t_xy &b)
{
return ( (t_xy){a.x + b.x, a.y + b.y} );
}
int main(int argc, char *argv[])
{
t_xy a = vec(1, 2);
t_xy b = vec(2, 4);
t_xy c = a + b;
printf("a == %f %f\n", a.x, a.y);
printf("b == %f %f\n", b.x, b.y);
printf("c == %f %f\n", c.x, c.y);
}
t_xy test = (t_xy){1.0, 2.0};
printf("test == %f %f\n", test.x, test.y);