summaryrefslogtreecommitdiffstats
path: root/lib/joinarrays.c
blob: 22070b0eb116f03e60c588c3252a19658d0d9b3c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#pragma once
#include <bvr.h>
// do not use this, this is idiotic, use strlcpy
char * join_null_terminated_arrays(char * a1, char * a2) { // returns null terminated array
	char sizeof0 = BVR_VALUE_CHUNK_SIZE;
	char * a0 = malloc(sizeof(char) * sizeof0);
	char i = 0;
	char position = 0;
	while(a1[i] != 0) {
		a0[position++] = a1[i++];
	}
	i = 0;
	while(a2[i] != 0) {
		a0[position++] = a2[i++];
	}
	a0[position++] = 0;
	return a0;
}