summaryrefslogtreecommitdiff
path: root/t/t_build_string.c
blob: f49cc2bc1f6df5b058e63231ae2cadb75f26d82d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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);
}