I know we should free any variable allocated with malloc, but what if I return it in a function? Something like this:
char *somefunction(int somearg){
char *str;
str=(char *)malloc(sizeof(char *));
//some code
return str;
}
Should I free str? How could I do that?