diff options
Diffstat (limited to 'šola/p2/dn/dn06-naloga1.c')
-rw-r--r-- | šola/p2/dn/dn06-naloga1.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/šola/p2/dn/dn06-naloga1.c b/šola/p2/dn/dn06-naloga1.c new file mode 100644 index 0000000..9301d71 --- /dev/null +++ b/šola/p2/dn/dn06-naloga1.c @@ -0,0 +1,29 @@ +#include <stdio.h> +#include <stdlib.h> +#include <stdbool.h> +#include <string.h> +#include "naloga1.h" +char * zdruzi (char ** nizi, char * locilo) { + int ll = strlen(locilo); + int len = 1-ll; + char ** n = nizi; + while (*n) + len += strlen(*n++)+ll; + char * r = malloc(sizeof *r * (len+1)); + char * rorig = r; + while (*nizi) { + strcpy(r, *nizi); + r += strlen(*nizi); + nizi++; + if (*nizi) { + strcpy(r, locilo); + r += ll; + } + } + return rorig; +} +#ifndef test +int main () { + return 0; +} +#endif |