diff options
author | thing1 <thing1@seacrossedlovers.xyz> | 2025-02-12 19:07:51 +0000 |
---|---|---|
committer | thing1 <thing1@seacrossedlovers.xyz> | 2025-02-12 19:07:51 +0000 |
commit | b4955284142f2f4767e75d36b73345087feee564 (patch) | |
tree | 05c544e9743df60568f8a42085325d7b7e5adcbf |
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile | 9 | ||||
-rw-r--r-- | cards.h | 6 | ||||
-rw-r--r-- | flash.c | 19 | ||||
-rw-r--r-- | util.h | 8 |
5 files changed, 43 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..980a7fc --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +flash diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e3e36a2 --- /dev/null +++ b/Makefile @@ -0,0 +1,9 @@ +flash: flash.c cards.h + cc flash.c -o flash + +install: flash + cp flash /usr/local/bin/flash + +uninstall: + rm /usr/local/bin/flash + @@ -0,0 +1,6 @@ +#include "util.h" + +card cards[] = { + {"what is 2 + 2", "4"}, + {"what is 2 + 5", "7"}, +}; @@ -0,0 +1,19 @@ +#include <stdio.h> +#include <stdlib.h> +#include <time.h> + +#include "cards.h" + +int main() { +loop: + srand(time(NULL)); + int n = rand() % len(cards); + + printf("%s\n", cards[n].front); + getchar(); + printf("%s\n", cards[n].back); + + goto loop; + + return 0; +} @@ -0,0 +1,8 @@ +#define len(c) sizeof(c) / sizeof(c[0]) + +#define CARDMAX 512 + +typedef struct card { + char front[CARDMAX]; + char back[CARDMAX]; +} card; |