From 87d82ead963c24d84a4f6e417b96b9bf73d132bb Mon Sep 17 00:00:00 2001 From: Preston Pan Date: Sun, 8 Jan 2023 14:44:25 -0800 Subject: fix memory problem --- src/macros.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/macros.c') diff --git a/src/macros.c b/src/macros.c index 1effefe..1643168 100644 --- a/src/macros.c +++ b/src/macros.c @@ -8,3 +8,10 @@ void die(char *message) { fprintf(stderr, "%sFATAL ERROR: %s%s\n", RED, message, reset); exit(EXIT_FAILURE); } + +char *char_to_string(char c) { + char *s = malloc(2); + s[0] = c; + s[1] = '\0'; + return s; +} -- cgit