diff options
Diffstat (limited to 't/t_build_string.c')
-rw-r--r-- | t/t_build_string.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/t/t_build_string.c b/t/t_build_string.c new file mode 100644 index 0000000..f49cc2b --- /dev/null +++ b/t/t_build_string.c @@ -0,0 +1,19 @@ +#include <string.h> +#include <stdio.h> +#include <stdlib.h> + +char * alloc_build_string(const char *ss[]); + +int main() +{ + const char *greets[] = {"hello", " world", " all", NULL}; + char *greet = alloc_build_string(greets); + char *greet2 = alloc_build_string((const char *[]){ + "hello world", " all", NULL + }); + printf("%d\n", strcmp(greet, "hello world all")); + printf("%d\n", strcmp(greet2, "hello world all")); + free(greet); + free(greet2); +} + |