BMWE
Member level 2
Hello
given the following code:
i should implement the str_cpy function.
how would you implement it efficiently (without memory leaks)?
given the following code:
Code:
void func(){
char *var=NULL;
str_cpy(var,"text1");
str_cpy(var,var+2);
some print(var) // result: xt1
some_free(var)
}
i should implement the str_cpy function.
how would you implement it efficiently (without memory leaks)?