summaryrefslogtreecommitdiff
path: root/vec.c
blob: 74ccc5a870118959b9cca7412494133a3e7af0cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <u.h>
#include <libc.h>

typedef struct Vec Vec;
struct Vec {
	double x, y, z;
};

Vec
addvec(Vec a, Vec b)
{
	a.x += b.x;
	a.y += b.y;
	a.z += b.z;
	return a;
}

void
main()
{
	Vec a = {20, 5, 3};
	Vec b = {6, -2, 19};

	a = addvec(a, b);
	exits(nil);
}