Pass the char* buffer & size of the buffer to the function and write to those parameters.
Local arrays you create in a function disappear when the function returns. You'd have to allocate it with malloc() if you want a local variable to survive a function return, but then someone else has to delete it with free(). The method I showed above is the standard safer way to do it.
char* func( char* buf, int size )
char str = "Hello World";
if ( size > strlen( str ) )
return strncpy( buf, str, (size - 1) );
return NULL; /* Error! buf isn't big enough. */
You can return a char* pointer like above, or better might be to return an int (0 for success, otherwise the buffer size required)...