I just want to concatenate two strings and a separator using a function. But in main() I am not getting the concatenated string.
#include <stdio.h>
#include <string.h>
 #include <stdlib.h>
char* PathCreation(char* Str1, char* Str2, char* Separator=(char*)"/"){
    char CreatedPath[strlen(Str1)+strlen(Str2)+strlen(Separator)+1];
    strncpy(&CreatedPath[0], Str1, strlen(Str1));
    strncpy(&CreatedPath[strlen(Str1)], Separator, strlen(Separator));
    strncpy(&CreatedPath[strlen(Str1)+1], Str2, strlen(Str2));
    CreatedPath[strlen(Str1)+strlen(Str2)+1]='\0';
    //printf("\n%s", CreatedPath);
    return CreatedPath;
}
int main(void)
{
    char str1[] = "foo";
    char str2[] = "bar";
    char* ccat=PathCreation(str1, str2);
    puts(str1);
    puts(str2);
    puts(ccat);
}
 
    