Impelement version with X macros

This commit is contained in:
2023-12-30 19:09:29 +00:00
parent 62e9a9405b
commit 6d1f5d3b4c
3 changed files with 148 additions and 0 deletions

18
03_xmacros/main.c Normal file
View File

@@ -0,0 +1,18 @@
#define VEC_IMPLEMENTATION
#include "vec.h"
#undef VEC_IMPLEMENTATION
#include <stdio.h>
int main(int argc, char *argv[]) {
vec2i_t v1 = (vec2i_t){2, 3};
vec2i_t v2 = (vec2i_t){4, 5};
vec_print(vec2i_t, vec_add(vec2i_t, v1, v2));
vec_print(vec2i_t, vec_sub(vec2i_t, v1, v2));
vec_print(vec2i_t, vec_mul(vec2i_t, v1, v2));
printf("%d\n", vec_dot(vec2i_t, v1, v2));
printf("%d\n", vec_magnitude(vec2i_t, v1));
printf("%d\n", vec_magnitude(vec2i_t, v2));
return 0;
}