I've this piece of code :
#include <stdio.h>
#include <string.h>
void b(char *in, char ** out);
int main()
{
char a[] = {'w','o','r','l','d','\0'};
char *d = nullptr;
b(a, &d);
printf("hello %s\n", d);
return 0;
}
void b(char *in, char ** out)
{
char tmp[10];
for(int i=0;i<6;i++)
tmp[i]=in[i];
*out=tmp;
printf("%s\n", *out);
}
I except to get theses printf :
world
hello world
But I get these :
world
hello
Why the d variable isn't fullfilled ? :(
Thanks for any clue about that !