char *operate(void){
char *s;
.....
.....
strcpy(s, ptr);
return s;
}

main(){
char *str = operate();
...
}